Skip to content
Snippets Groups Projects
Commit c19b4db8 authored by Alex Kakiris's avatar Alex Kakiris
Browse files

Fix response messages for register operations

parent 5eab19d4
No related branches found
No related tags found
2 merge requests!43Staging to Main for Release 1,!10Ocf4 register user password must be hashed
Pipeline #4659 failed
...@@ -52,11 +52,11 @@ class RegisterOperations: ...@@ -52,11 +52,11 @@ class RegisterOperations:
exist_user = mycol.find_one({"username": username}) exist_user = mycol.find_one({"username": username})
if exist_user is None: if exist_user is None:
return jsonify("Not exister user with this credentials"), 400 return jsonify("No user with these credentials"), 400
stored_password = exist_user["password"] stored_password = exist_user["password"]
if not bcrypt.checkpw(password.encode('utf-8'), stored_password): if not bcrypt.checkpw(password.encode('utf-8'), stored_password):
return jsonify("Not exister user with this credentials"), 400 return jsonify("No user with these credentials"), 400
access_token = create_access_token(identity=(username + " " + exist_user["role"])) access_token = create_access_token(identity=(username + " " + exist_user["role"]))
url = f"http://{self.config['ca_factory']['url']}:{self.config['ca_factory']['port']}/v1/secret/data/ca" url = f"http://{self.config['ca_factory']['url']}:{self.config['ca_factory']['port']}/v1/secret/data/ca"
...@@ -78,11 +78,11 @@ class RegisterOperations: ...@@ -78,11 +78,11 @@ class RegisterOperations:
exist_user = mycol.find_one({"username": username}) exist_user = mycol.find_one({"username": username})
if exist_user is None: if exist_user is None:
return jsonify("Not exister user with this username"), 400 return jsonify("No user with these credentials"), 400
stored_password = exist_user["password"] stored_password = exist_user["password"]
if not bcrypt.checkpw(password.encode('utf-8'), stored_password): if not bcrypt.checkpw(password.encode('utf-8'), stored_password):
return jsonify("Not exister user with this password"), 400 return jsonify("No user with these credentials"), 400
mycol.delete_one({"username": username}) mycol.delete_one({"username": username})
return jsonify(message="User removed successfully"), 204 return jsonify(message="User removed successfully"), 204
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment