6 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
5 changed files with 9 additions and 15 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:
@@ -196,7 +194,3 @@ volumes:
driver: local driver: local
logs: logs:
driver: local driver: local
secrets:
postgres_password:
external: true