linotp.lib.tools.set_password module

set password handler -

enable the user to change his password

class linotp.lib.tools.set_password.DataBaseContext(sql_url)

Bases: object

the database context - used to preseve the engine, which is required for the unit test, where the sqlite database resides in memory

get_engine()

provide access to the sql engine

Returns

the initialized db engine

get_session()

build a new db session on demand

Returns

a new session, which is closed with a session.close()

class linotp.lib.tools.set_password.SetPasswordHandler(db_context)

Bases: ToolsHandler

the handler to change the admin password

class AdminUser(**kwargs)

Bases: Model

AdminUser - the db user entry - we use here the same class defintion as for the user import

which will allow to place a managed resolver on top of this

email
givenname
groupid
mobile
password
phone
surname
userid
username
static create_admin_user(db_context, username, crypted_password)

create the initial admin user with his password if it does not exists - called during server start

Parameters
  • db_context – object to provide the database engine and connection

  • username – the name of the admin user

  • crypted_password – the lib crypt encrypted password

Returns

  • nothing -

static create_table(db_context)

create the table to store the users - internal function, called at the import start

Parameters

db_context – object to provide the database engine and connection

Returns

  • nothing -

set_password(username, old_password, new_password)

set the password, which requires the old_password for authorisation

Parameters
  • username – the admin username

  • old_password – use the old password for authorisation

  • new_password – the new password

Returns

  • nothing -