mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Implementation of the new_password endpoint.
Found a way to create the token that does not need to persist it to the database. This requires proper error messages, written by people who speak menglis good.
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import uuid
|
||||
|
||||
from app.main.dao import password_reset_token_dao
|
||||
from tests.app.main import create_test_user
|
||||
|
||||
|
||||
def test_should_insert_and_return_token(notifications_admin, notifications_admin_db, notify_db_session):
|
||||
user = create_test_user('active')
|
||||
token_id = str(uuid.uuid4())
|
||||
password_reset_token_dao.insert(token=token_id, user_id=user.id)
|
||||
saved_token = password_reset_token_dao.get_token(token_id)
|
||||
assert saved_token.token == token_id
|
||||
@@ -176,7 +176,7 @@ def test_should_update_password(notifications_admin, notifications_admin_db, not
|
||||
saved = users_dao.get_user_by_id(user.id)
|
||||
assert check_hash('somepassword', saved.password)
|
||||
assert saved.password_changed_at is None
|
||||
users_dao.update_password(saved.id, 'newpassword')
|
||||
users_dao.update_password(saved.email_address, 'newpassword')
|
||||
updated = users_dao.get_user_by_id(user.id)
|
||||
assert check_hash('newpassword', updated.password)
|
||||
assert updated.password_changed_at < datetime.now()
|
||||
|
||||
Reference in New Issue
Block a user