MCPcopy Index your code
hub / github.com/tiny-pilot/tinypilot / change_password

Function change_password

app/auth.py:110–129  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

108
109
110def 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
132def change_role(username, new_role):

Callers

nothing calls this directly

Calls 2

change_passwordMethod · 0.80
info_sensitiveMethod · 0.80

Tested by

no test coverage detected