Ejemplo n.º 1
0
def password_resetter():
    request_json = request.get_json(force=True)

    result = send_reset_mail(
        request_json['email'], url_head + "/password_resetter?token=" +
        generate_register_token(request_json['email']), email_config)

    if result != "success":
        return failure(result)
    return success("")
Ejemplo n.º 2
0
def confirm():
    request_json = request.get_json(force=True)

    if not current_user.check_password(request_json['password']):
        return failure("原密码错误")

    result = send_confirm_email(
        current_user.username, request_json['email'], url_head +
        "/confirm?token=" + generate_register_token(request_json['email']),
        email_config)

    if result != "success":
        return failure(result)
    return success("")
Ejemplo n.º 3
0
def regiester():
    request_json = request.get_json(force=True)

    check_res = field_checker(request_json, ['email'])
    if check_res is not None:
        return failure(check_res)

    result = send_register_mail(
        request_json['email'], url_head + "/register?token=" +
        generate_register_token(request_json['email']), email_config)

    if result != "success":
        return failure(result)
    return success("")