alchemy flush and save functions updated
This commit is contained in:
@@ -79,7 +79,6 @@ class MongoQueryIdentity:
|
||||
hashed_password = payload.password_add.get("password")
|
||||
for password_in_history in password_history_list:
|
||||
if str(password_in_history.get("password")) == str(hashed_password):
|
||||
print('Password already used. Please enter a new password that you have not used last 3 times.')
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="Password already used. Please enter a new password that you have not used last 3 times.",
|
||||
@@ -89,7 +88,7 @@ class MongoQueryIdentity:
|
||||
password_history_list.pop(0)
|
||||
|
||||
password_history_list.append(payload.password_add)
|
||||
self.mongo_engine.update(
|
||||
return self.mongo_engine.update(
|
||||
match=payload.user_uu_id,
|
||||
payload={
|
||||
"password_history": password_history_list,
|
||||
@@ -98,7 +97,6 @@ class MongoQueryIdentity:
|
||||
},
|
||||
field="user_uu_id",
|
||||
)
|
||||
return True
|
||||
|
||||
def get_password_history_via_user(self, user_uu_id):
|
||||
self.use_collection("PasswordHistory")
|
||||
|
||||
@@ -61,7 +61,6 @@ class MongoQuery:
|
||||
return self.table.insert_many(documents=[payload])
|
||||
|
||||
def update(self, match, payload, field: str = "id"):
|
||||
print('update', match, payload, field)
|
||||
if field == "id":
|
||||
filter_ = {"_id": ObjectId(match)}
|
||||
self.table.update_one(filter=filter_, update={"$set": payload})
|
||||
|
||||
Reference in New Issue
Block a user