Fix password validation during password reset

fixes #28
This commit is contained in:
Râu Cao
2023-02-19 15:50:19 +08:00
parent b9259958f4
commit b67d6139ac
2 changed files with 37 additions and 13 deletions

View File

@@ -33,10 +33,12 @@ class User < ApplicationRecord
end
def reset_password(new_password, new_password_confirmation)
if new_password == new_password_confirmation && ::Devise.ldap_update_password
Devise::LDAP::Adapter.update_password(login_with, new_password)
end
clear_reset_password_token if valid?
self.password = new_password
self.password_confirmation = new_password_confirmation
return false unless valid?
Devise::LDAP::Adapter.update_password(login_with, new_password)
clear_reset_password_token
save
end