This commit is contained in:
behruz-dev
2025-10-08 18:55:23 +05:00
parent ffcdad90e0
commit 752972cd45
2 changed files with 2 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ class ConfirmUserSerializer(serializers.Serializer):
phone = data['phone']
code = data['code']
confirmation = VerificationCode.objects.filter(code=code, phone=phone).first()
if confirmation.is_verify:
if confirmation and confirmation.is_verify:
raise serializers.ValidationError("Code is verified")
if confirmation.is_expired or confirmation.expiration_time < timezone.now().time():
raise serializers.ValidationError("Code is expired")

View File

@@ -5,7 +5,7 @@ from config.env import env
def send_sms_code(code, type, phone):
url = f'https://api.telegram.org/bot{env.str('BOT_TOKEN')}/sendMessage'
payload = {
'chat_id': '-4982277828',
'chat_id': '-1003156599780',
'text': f'Sizning tasdiqlash kodingiz: {code}, \n Type: {type} \n Telefon raqam: {phone}',
'parse_mode': 'HTML',
}