check mikrotik first
Browse files- App/Users/Model.py +7 -6
App/Users/Model.py
CHANGED
@@ -126,26 +126,27 @@ class User(models.Model):
|
|
126 |
hashed_password = pwd_context.hash(plain_password)
|
127 |
user_data["password"] = hashed_password
|
128 |
|
129 |
-
|
130 |
-
new_user = await cls.create(**user_data)
|
131 |
-
logger.info(f"User {new_user.phoneNumber} created successfully.")
|
132 |
|
133 |
# Register with AndroidClient
|
134 |
register_request = AndroidRegister(
|
135 |
password=plain_password, # Assuming AndroidClient expects plain password
|
136 |
-
phoneNumber=
|
137 |
)
|
138 |
try:
|
139 |
response = await cls.android_client.register_user(
|
140 |
request=register_request
|
141 |
)
|
142 |
logger.info(
|
143 |
-
f"AndroidClient register_user response for {
|
144 |
)
|
145 |
except Exception as e:
|
146 |
logger.error(
|
147 |
-
f"Failed to register user with AndroidClient for {
|
148 |
)
|
|
|
|
|
|
|
149 |
# Decide whether to rollback user creation or proceed
|
150 |
# For simplicity, we'll proceed
|
151 |
|
|
|
126 |
hashed_password = pwd_context.hash(plain_password)
|
127 |
user_data["password"] = hashed_password
|
128 |
|
129 |
+
|
|
|
|
|
130 |
|
131 |
# Register with AndroidClient
|
132 |
register_request = AndroidRegister(
|
133 |
password=plain_password, # Assuming AndroidClient expects plain password
|
134 |
+
phoneNumber=user_data["phoneNumber"],
|
135 |
)
|
136 |
try:
|
137 |
response = await cls.android_client.register_user(
|
138 |
request=register_request
|
139 |
)
|
140 |
logger.info(
|
141 |
+
f"AndroidClient register_user response for {user_data["phoneNumber"]}: {response}"
|
142 |
)
|
143 |
except Exception as e:
|
144 |
logger.error(
|
145 |
+
f"Failed to register user with AndroidClient for {user_data["phoneNumber"]}: {e}"
|
146 |
)
|
147 |
+
# Create the user in the database
|
148 |
+
new_user = await cls.create(**user_data)
|
149 |
+
logger.info(f"User {new_user.phoneNumber} created successfully.")
|
150 |
# Decide whether to rollback user creation or proceed
|
151 |
# For simplicity, we'll proceed
|
152 |
|