def _update_admin_password(new_password): """Update the admin user's password.""" with setup_flask_app().app_context(): user = user_datastore.get_user('admin') user.password = hash_password(new_password) # Unlock account user.failed_logins_counter = 0 user_datastore.commit()
def _update_admin_password(new_password): """Update the admin user's password.""" with setup_flask_app().app_context(): config.instance.load_configuration() user = user_datastore.get_user('admin') user.password = hash_password(new_password) # Unlock account user.failed_logins_counter = 0 user.active = True user_datastore.commit()
def get(self, username, multi_tenancy): """ Get details for a single user """ rest_utils.validate_inputs({'username': username}) # allow user that queries about himself to avoid admin authorization if username == current_user.username: return user_datastore.get_user(current_user.username) return multi_tenancy.get_user(username)
def get(self): """ Get details for the current user """ return user_datastore.get_user(current_user.username)
def get_user_from_auth(auth): if not auth: return None return user_datastore.get_user(auth.username)
def get_user_from_auth(auth): if not auth or not auth.username: return None if auth.username[0] not in string.ascii_letters: return None return user_datastore.get_user(auth.username)
def get_user_from_auth(auth): return user_datastore.get_user(auth.username)
def _update_admin_password(new_password): adm = user_datastore.get_user('admin') if verify_password(new_password, adm.password): # no change return adm.password = hash_password(new_password) user_datastore.commit()