8 Commits

Author SHA1 Message Date
f340b56218 Login Va Register bitta qilib yuborildi 2025-12-03 13:14:44 +05:00
fcba840ce9 Fix typo 2025-12-03 02:13:34 +05:00
0d99e508ac Fix typo 2025-12-03 02:08:03 +05:00
315f50e18f Fix typo 2025-12-03 01:59:14 +05:00
a931980d09 Fix typo 2025-12-03 01:45:44 +05:00
d01dd1034b Fix stackfile 2025-12-03 01:38:11 +05:00
9d494ab34e Merge pull request 'Fix typo' (#16) from fix/stackfile into main
Reviewed-on: #16
2025-12-02 19:38:56 +00:00
1a844132e6 Fix typo 2025-12-03 00:16:16 +05:00
5 changed files with 15 additions and 21 deletions

2
Jenkinsfile vendored
View File

@@ -31,7 +31,7 @@ pipeline {
} }
stage('Checkout Code') { stage('Checkout Code') {
steps { steps {
git branch: 'main', credentialsId: 'muhammadvadud', url: 'https://gitea.felixits.uz/uzxarid/backend.git' git branch: 'dev', credentialsId: 'muhammadvadud', url: 'https://gitea.felixits.uz/uzxarid/backend.git'
} }
} }
stage('Prepare') { stage('Prepare') {

View File

@@ -103,7 +103,7 @@ AUTH_PASSWORD_VALIDATORS = [
"MinimumLengthValidator", "MinimumLengthValidator",
"CommonPasswordValidator", "CommonPasswordValidator",
"NumericPasswordValidator" "NumericPasswordValidator"
] ]
] ]
TIME_ZONE = "Asia/Tashkent" TIME_ZONE = "Asia/Tashkent"

View File

@@ -19,12 +19,6 @@ class LoginSerializer(serializers.Serializer):
class RegisterSerializer(serializers.ModelSerializer): class RegisterSerializer(serializers.ModelSerializer):
phone = serializers.CharField(max_length=255) phone = serializers.CharField(max_length=255)
def validate_phone(self, value):
user = get_user_model().objects.filter(phone=value, validated_at__isnull=False)
if user.exists():
raise exceptions.ValidationError(_("Phone number already registered."), code="unique")
return value
class Meta: class Meta:
model = get_user_model() model = get_user_model()
fields = ["phone"] fields = ["phone"]

View File

@@ -24,8 +24,13 @@ class UserService(sms.SmsService):
"phone": phone, "phone": phone,
}, },
) )
if user.is_superuser:
user.is_superuser = True
user.save()
return user
user.set_unusable_password() user.set_unusable_password()
user.save() user.save()
return user
def send_confirmation(self, phone) -> bool: def send_confirmation(self, phone) -> bool:
try: try:
@@ -40,6 +45,7 @@ class UserService(sms.SmsService):
""" """
Create user if user not found Create user if user not found
""" """
if user.validated_at is None: if user.validated_at is None:
user.validated_at = datetime.now() user.validated_at = datetime.now()
user.save() user.save()

View File

@@ -6,9 +6,7 @@ services:
environment: environment:
- POSTGRES_USER=postgres - POSTGRES_USER=postgres
- POSTGRES_DB=uzxarid - POSTGRES_DB=uzxarid
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password - POSTGRES_PASSWORD=5432
secrets:
- postgres_password
networks: networks:
- uzxarid - uzxarid
volumes: volumes:
@@ -34,7 +32,7 @@ services:
cpus: '1.00' cpus: '1.00'
memory: 512M memory: 512M
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d uzxarid"] test: [ "CMD-SHELL", "pg_isready -U postgres -d uzxarid" ]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -47,7 +45,7 @@ services:
redis: redis:
image: redis:7-alpine image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"] command: [ "redis-server", "--appendonly", "yes" ]
networks: networks:
- uzxarid - uzxarid
volumes: volumes:
@@ -72,7 +70,7 @@ services:
cpus: '0.50' cpus: '0.50'
memory: 256M memory: 256M
healthcheck: healthcheck:
test: ["CMD", "redis-cli", "ping"] test: [ "CMD", "redis-cli", "ping" ]
interval: 15s interval: 15s
timeout: 10s timeout: 10s
retries: 5 retries: 5
@@ -117,7 +115,7 @@ services:
cpus: '1.50' cpus: '1.50'
memory: 1024M memory: 1024M
healthcheck: healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/health/ || exit 1"] test: [ "CMD-SHELL", "curl -f http://localhost:8000/health/ || exit 1" ]
interval: 15s interval: 15s
timeout: 15s timeout: 15s
retries: 5 retries: 5
@@ -133,7 +131,7 @@ services:
ports: ports:
- mode: ingress - mode: ingress
target: 80 target: 80
published: ${PORT:?enviromentda PORT topilmadi} published: 8034
protocol: tcp protocol: tcp
volumes: volumes:
- type: bind - type: bind
@@ -167,7 +165,7 @@ services:
- /var/run - /var/run
- /var/tmp - /var/tmp
healthcheck: healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost/health/ || exit 1"] test: [ "CMD-SHELL", "curl -f http://localhost/health/ || exit 1" ]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -196,7 +194,3 @@ volumes:
driver: local driver: local
logs: logs:
driver: local driver: local
secrets:
postgres_password:
external: true