예제 #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)