Changes the password of the account with the given username. Args: username: (str) new_password: (str) Raises: db.users.UserDoesNotExistError: If a user with the given username does not exist on the system.
(username, new_password)
| 108 | |
| 109 | |
| 110 | def change_password(username, new_password): |
| 111 | """Changes the password of the account with the given username. |
| 112 | |
| 113 | Args: |
| 114 | username: (str) |
| 115 | new_password: (str) |
| 116 | |
| 117 | Raises: |
| 118 | db.users.UserDoesNotExistError: If a user with the given username |
| 119 | does not exist on the system. |
| 120 | """ |
| 121 | db.users.Users().change_password( |
| 122 | username=username, |
| 123 | new_password_hash=password_check.generate_hash(new_password), |
| 124 | credentials_change_time=utc.now()) |
| 125 | # We're knowingly logging a user's username, which is sensitive, but we've |
| 126 | # also marked the log as sensitive that can later be scrubbed. |
| 127 | logger.info_sensitive( # nosemgrep: python-logger-credential-disclosure |
| 128 | 'Changed password of user %s', username) |
| 129 | video_service.restart() |
| 130 | |
| 131 | |
| 132 | def change_role(username, new_role): |
nothing calls this directly
no test coverage detected