本文整理汇总了Python中src.models.user.User.check_login方法的典型用法代码示例。如果您正苦于以下问题:Python User.check_login方法的具体用法?Python User.check_login怎么用?Python User.check_login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.models.user.User
的用法示例。
在下文中一共展示了User.check_login方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login_user
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import check_login [as 别名]
def login_user():
user_email = request.form['email']
user_password = request.form['password']
if User.check_login(user_email, user_password):
session['email'] = user_email
return redirect(url_for('index'))
else:
return redirect(url_for('login_page', error_message="Your username or password was incorrect."))
示例2: edit_profile
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import check_login [as 别名]
def edit_profile():
if User.check_login(session['email'], request.form['password']):
user = User.find_by_email(session['email'])
user.data.update(firstname=request.form['firstname'], lastname=request.form['lastname'],
university=request.form['university'], level=request.form['level'],
country=request.form['country'], school=request.form['college'],
subject=request.form['course'], year=request.form['yearofstudy'])
user.save_to_db()
return make_response(view_profile())
else:
return render_template('user-profile.html', message="Incorrect Password")
示例3: admin_update_user_profile
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import check_login [as 别名]
def admin_update_user_profile():
if User.check_login(session['email'], request.form['password']):
user = User.find_by_email(request.form['email'])
user.data.update(firstname=request.form['firstname'], lastname=request.form['lastname'],
university=request.form['university'], level=request.form['level'],
country=request.form['country'], school=request.form['college'],
subject=request.form['course'], year=request.form['yearofstudy'],
permissions=request.form['permissions'])
user.save_to_db()
return redirect("/admin/view-profile/" + request.form['email'])
else:
return render_template('user-profile.html', message="Incorrect Password")
示例4: check_password
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import check_login [as 别名]
def check_password():
json = request.get_json()
password = json['password']
if User.check_login(session['email'], password):
return jsonify({"message": "OK"}), 201
return jsonify({"error": "Password is incorrect"}), 201