def reset_password ( app , appbuilder , username , password ) : _appbuilder = import_application ( app , appbuilder ) user = _appbuilder . sm . find_user ( username = username ) if not user : click . echo ( "User {0} not found." . format ( username ) ) else : _appbuilder . sm . reset_password ( user . id , password ) click . echo ( click . style ( "User {0} reseted." . format ( username ) , fg = "green" ) )
reset password using flask python
Resets a user s password
def reset_password(app, appbuilder, username, password):
    """
        Resets a user's password
    """
    _appbuilder = import_application(app, appbuilder)
    user = _appbuilder.sm.find_user(username=username)
    if not user:
        click.echo("User {0} not found.".format(username))
    else:
        _appbuilder.sm.reset_password(user.id, password)
        click.echo(click.style("User {0} reseted.".format(username), fg="green"))