Beispiel #1
0
def trigger_reset():
    """
    Allow user to trigger a reset of the password in case they forget it
    """
    email = request_data().get('email')

    # Simple check to see if the email was provided. Flash error if not
    if email is None or not len(email):
        return jsonify({
            'status': 'error',
            'message': _("Please enter an email address!")
        }, status=400)

    account = Account.by_email(email)

    # If no account is found we let the user know that it's not registered
    if account is None:
        return jsonify({
            'status': 'error',
            'message': _("No user is registered under this address!")
        }, status=400)

    # Send the reset link to the email of this account
    send_reset_link(account)
    return jsonify({
        'status': 'ok',
        'message': _("You've received an email with a link to reset your "
                     "password. Please check your inbox.")
    })
Beispiel #2
0
def trigger_reset():
    """
    Allow user to trigger a reset of the password in case they forget it
    """
    email = request_data().get('email')

    # Simple check to see if the email was provided. Flash error if not
    if email is None or not len(email):
        return jsonify(
            {
                'status': 'error',
                'message': _("Please enter an email address!")
            },
            status=400)

    account = Account.by_email(email)

    # If no account is found we let the user know that it's not registered
    if account is None:
        return jsonify(
            {
                'status': 'error',
                'message': _("No user is registered under this address!")
            },
            status=400)

    # Send the reset link to the email of this account
    send_reset_link(account)
    return jsonify({
        'status':
        'ok',
        'message':
        _("You've received an email with a link to reset your "
          "password. Please check your inbox.")
    })
Beispiel #3
0
def do_reset():
    email = request.args.get('email')
    if email is None or not len(email):
        return redirect('/login')

    account = Account.by_email(email)
    if account is None:
        return redirect('/login')

    if request.args.get('token') != account.token:
        return redirect('/login')

    login_user(account)
    return redirect('/settings')
Beispiel #4
0
def do_reset():
    email = request.args.get('email')
    if email is None or not len(email):
        # flash_error(_("The reset link is invalid!"))
        return redirect('/login')

    account = Account.by_email(email)
    if account is None:
        # flash_error(_("No user is registered under this address!"))
        return redirect('/login')

    if request.args.get('token') != account.token:
        # flash_error(_("The reset link is invalid!"))
        return redirect('/login')

    login_user(account)
    # flash_success(
    #     _("Thanks! You have now been signed in - please change "
    #       "your password!"))
    return redirect('/settings')
Beispiel #5
0
def do_reset():
    email = request.args.get('email')
    if email is None or not len(email):
        # flash_error(_("The reset link is invalid!"))
        return redirect('/login')

    account = Account.by_email(email)
    if account is None:
        # flash_error(_("No user is registered under this address!"))
        return redirect('/login')

    if request.args.get('token') != account.token:
        # flash_error(_("The reset link is invalid!"))
        return redirect('/login')

    login_user(account)
    # flash_success(
    #     _("Thanks! You have now been signed in - please change "
    #       "your password!"))
    return redirect('/settings')