diff options
Diffstat (limited to 'captain/db.f90')
-rw-r--r-- | captain/db.f90 | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/captain/db.f90 b/captain/db.f90 index 7500b8a..29c5810 100644 --- a/captain/db.f90 +++ b/captain/db.f90 @@ -1477,27 +1477,23 @@ contains function validate_user_db(username, password) use config, only: app_salt - use m_crypt, only: hash + use m_crypt, only: verify_hash + use logging implicit none character(len=*), intent(in)::username, password logical::validate_user_db - character(len=:), pointer::hashed_pass, db_hashed_pass + character(len=:), pointer::db_hashed_pass validate_user_db = .FALSE. + + db_hashed_pass => get_password_hash_pointer_db(username) + if(associated(db_hashed_pass)) then - hashed_pass => hash(trim(password)//trim(app_salt)) - if(associated(hashed_pass)) then - db_hashed_pass => get_password_hash_pointer_db(username) - if(associated(db_hashed_pass)) then + validate_user_db = verify_hash(trim(password)//trim(app_salt), db_hashed_pass) - validate_user_db = (hashed_pass == db_hashed_pass) - - deallocate(db_hashed_pass) - end if - - deallocate(hashed_pass) + deallocate(db_hashed_pass) end if end function validate_user_db |