本文整理汇总了Python中model.authenticate函数的典型用法代码示例。如果您正苦于以下问题:Python authenticate函数的具体用法?Python authenticate怎么用?Python authenticate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authenticate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_login
def process_login():
model.connect_to_db()
username = request.form.get("username")
password = request.form.get("password")
user_id = model.authenticate(username, password)
if model.authenticate(username, password):
flash("User authenticated")
session['user_id'] = user_id
else:
flash("Password incorrect, there may be a ferret stampede in progress!")
return redirect(url_for("index"))
示例2: process_login
def process_login():
email = request.form.get("email")
password = request.form.get("password")
if model.authenticate(email, password):
user_email, user_id = model.authenticate(email, password)
if email != None:
flash ("Welcome, %s!" % str(user_email))
session['user_id'] = user_id # put user_id into the session rather than email
else:
flash("Authentication failed.")
return redirect(url_for("index"))
示例3: on_btn_login_clicked
def on_btn_login_clicked(self):
usr_name = unicode(self.edit_usr_name.text())
pwd = unicode(self.edit_pwd.text())
if not model.authenticate(usr_name, pwd):
QMessageBox.critical(self, u"登录", u"用户名或密码错误!")
else:
self.done(QDialog.Accepted)
示例4: authenticate
def authenticate():
login_email = request.form['email']
login_pw = request.form['password']
usr_auth = model.authenticate(g.db, login_email, login_pw)
print usr_auth
session['usr_id'] = usr_auth['id']
return redirect(url_for('list_tasks'))
示例5: login
def login():
email = request.form['email']
password = request.form['password']
db = model.connect_db()
auth_user = model.authenticate(db, email, password)
if auth_user != None:
return redirect("/Tasks")
示例6: authenticate
def authenticate():
email = request.form['email']
password = request.form['password']
# capture the userid information from model-database
user_id = model.authenticate(g.db, email, password)
session['user_id'] = user_id
# after getting the session variable back, you have to point it to a page
return redirect("/")
示例7: authenticate
def authenticate():
email = request.form["email"]
password = request.form["password"]
user_id = model.authenticate(g.db, email, password)
if user_id == None:
error = "no user with that combination"
return render_template("/login.html", error=error)
session["user_id"] = user_id
return redirect("/tasks")
示例8: authenticate
def authenticate():
db = model.connect_db()
email = request.form['email']
password = request.form['password']
user_info = model.authenticate(db, email, password)
if user_info == None:
return redirect('/')
else:
return redirect('/tasks')
示例9: process_login
def process_login():
username = request.form.get("username")
password = request.form.get("password")
if model.authenticate(username, password):
flash("User authenticated!")
else:
flash('Password incorrect!')
return redirect(url_for("index"))
示例10: process_login
def process_login():
# form.get("___") --> blank corresponds to name in HTML form
email = request.form.get("email")
password = request.form.get("password")
if model.authenticate(email, password):
return render_template("login.html", email=email, password=password)
# redirect to logged in user page instead
else:
return render_template("login_fail.html")
示例11: login
def login():
email = request.form.get("email")
password = request.form.get("password")
user_id = model.authenticate(email, password)
if user_id == None:
flash("User does not exist")
return redirect(url_for("index"))
else:
session['id'] = user_id
return redirect(url_for("profile", user_id =user_id))
示例12: process_login
def process_login():
email = request.form.get("email")
password = request.form.get("password")
if model.authenticate(email, password):
user_object = model_session.query(model.User).filter_by(email=email).first()
session['id'] = user_object.user_id
return redirect(url_for("user_movies", user_id=user_object.user_id))
else:
flash("Login incorrect!")
return redirect("/")
示例13: authenticate
def authenticate():
email = request.form['email']
password = request.form['password']
user_id = model.authenticate(self, email, password)
if user_id != None:
session['user_id'] = user_id
return render_template("ratings.html")
else:
return redirect("/login")
示例14: process_login
def process_login():
user_id = request.form.get("user_id")
password = request.form.get("password")
user_id = model.authenticate(user_id, password)
if user_id:
flash("User authenticated")
session["user_id"] = user_id
else:
flash("WRONG.")
return redirect(url_for("index"))
示例15: POST
def POST(self):
login = web.input()
if model.authenticate(login.username,login.password)=='True':
session.logged_in = True
session.username = login.username
print session
raise web.seeother('/home')
else:
raise web.seeother('/login')
return render.form()