当前位置: 首页>>代码示例>>Python>>正文


Python model.authenticate函数代码示例

本文整理汇总了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"))
开发者ID:graciegutman,项目名称:session_lesson,代码行数:13,代码来源:app.py

示例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"))
开发者ID:graciegutman,项目名称:Movie_Beratings,代码行数:13,代码来源:judgement.py

示例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)
开发者ID:ax003d,项目名称:temp_monitor,代码行数:7,代码来源:logindlg.py

示例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'))
开发者ID:deegill,项目名称:tipsytasklist,代码行数:7,代码来源:tipsy.py

示例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")
开发者ID:Eleonore9,项目名称:Tipsy,代码行数:7,代码来源:tipsy.py

示例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("/")
开发者ID:nyghtowl,项目名称:HB_Wk4_LAMP,代码行数:8,代码来源:tipsy.py

示例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")
开发者ID:margaretblue,项目名称:tipsy,代码行数:9,代码来源:tipsy.py

示例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')
开发者ID:ericachang018,项目名称:tipsy,代码行数:9,代码来源:tipsy.py

示例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"))
开发者ID:JennieOhyoung,项目名称:session_lesson,代码行数:9,代码来源:app.py

示例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")
开发者ID:avastjohn,项目名称:Ratings_For_Movies,代码行数:9,代码来源:judgement.py

示例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))
开发者ID:KelseyYocum,项目名称:Movie_Ratings,代码行数:10,代码来源:judgement.py

示例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("/")
开发者ID:thehungrysmurf,项目名称:movie_ratings,代码行数:10,代码来源:judgment.py

示例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")
开发者ID:ericachang018,项目名称:Ratings,代码行数:10,代码来源:judgement.py

示例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"))    
开发者ID:katrinamariehh,项目名称:ratings,代码行数:11,代码来源:judgement.py

示例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()
开发者ID:alwaysabe,项目名称:dyn-sms,代码行数:11,代码来源:dynsms.py


注:本文中的model.authenticate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。