コード例 #1
0
ファイル: commands.py プロジェクト: merepro/galah
def reset_password(current_user, email, new_password=""):
    the_user = _get_user(email, current_user)

    if new_password:
        the_user.seal = serialize_seal(seal(new_password))
    else:
        the_user.seal = None

    the_user.save()

    return "Success! Password for %s succesfully reset." % _user_to_str(the_user)
コード例 #2
0
ファイル: commands.py プロジェクト: merepro/galah
def create_user(email, password="", account_type="student"):
    new_user = User(email=email, account_type=account_type)

    if password:
        new_user.seal = serialize_seal(seal(password))

    try:
        new_user.save(force_insert=True)
    except OperationError:
        raise UserError("A user with that email already exists.")

    return "Success! %s created." % _user_to_str(new_user)
コード例 #3
0
def reset_password(current_user, email, new_password=""):
    the_user = _get_user(email, current_user)

    if new_password:
        the_user.seal = serialize_seal(seal(new_password))
    else:
        the_user.seal = None

    the_user.save()

    return "Success! Password for %s succesfully reset." \
                % _user_to_str(the_user)
コード例 #4
0
def create_user(email, password="", account_type="student"):
    new_user = User(email=email, account_type=account_type)

    if password:
        new_user.seal = serialize_seal(seal(password))

    try:
        new_user.save(force_insert=True)
    except OperationError:
        raise UserError("A user with that email already exists.")

    return "Success! %s created." % _user_to_str(new_user)
コード例 #5
0
ファイル: commands.py プロジェクト: bmars003/galah
def reset_password(current_user, email, new_password = ""):
    the_user = _get_user(email, current_user)

    if current_user.account_type != "admin" and \
            current_user.email != the_user.email:
        raise UserError("Only admins can set other user's password.")

    if new_password:
        the_user.seal = serialize_seal(seal(new_password))
    else:
        the_user.seal = None

    the_user.save()

    return "Success! Password for %s succesfully reset." \
                % _user_to_str(the_user)
コード例 #6
0
def reset_password(current_user, email, new_password=""):
    the_user = _get_user(email, current_user)

    if current_user.account_type != "admin" and \
            current_user.email != the_user.email:
        raise UserError("Only admins can set other user's password.")

    if new_password:
        the_user.seal = serialize_seal(seal(new_password))
    else:
        the_user.seal = None

    the_user.save()

    return "Success! Password for %s succesfully reset." \
                % _user_to_str(the_user)