示例#1
0
文件: views.py 项目: shawyue/blog
def verify_email():
    email = request.form["email"]
    log.debug(email)
    if (RegisterUser.verify_email(email)):
        return jsonify({"result": 1})
    else:
        return jsonify({"result": 0})
示例#2
0
文件: views.py 项目: shawyue/blog
def signin():
    log.debug(request.form)
    input_email = request.form.get("inputEmail", None)
    input_password = request.form.get("inputPassword", None)
    remember_me = request.form.get("remember_me", "0")
    if remember_me == "1":
        remember_me = True
    else:
        remember_me = False
    log.debug(RegisterUser.verify_email(input_email))
    if (RegisterUser.verify_email(input_email) is False):
        user = User(RegisterUser.get_id(input_email))

    if user.verify_password(input_password):
        login_user(user, remember=remember_me)
        return redirect(request.args.get("next") or url_for("main.home"))
    return jsonify({"result": 0})