• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python model.authenticate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中model.authenticate函数的典型用法代码示例。如果您正苦于以下问题:Python authenticate函数的具体用法?Python authenticate怎么用?Python authenticate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了authenticate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: process_login

def process_login():
    emailform = request.form.get("email")
    passwordform = request.form.get("password")

    email = model.authenticate(emailform, hash(passwordform))
    if email != None:
        flash("User authenticated!")
        session['email'] = email
    else:
        flash("Password incorrect, please try again.")
    return redirect(url_for("main_menu"))
开发者ID:ankitaiyer,项目名称:HBProject,代码行数:11,代码来源:carpool.py


示例17: login

def login():
    if request.method == 'POST':
        user = model.authenticate(request.form['username'], request.form['password'])
        if user:
            login_user(user)
            url = request.form['next'] if 'next' in request.form else '/'
            return redirect(url)
        else:
            flash('Invalid login', 'error')
            return redirect('/login')
    return render_template('login.html', next=request.args.get('next'))
开发者ID:dhumbert,项目名称:lifeline,代码行数:11,代码来源:lifeline.py


示例18: login

def login():
  #TODO: add validation
  form = request.form
  email = form["email"]
  password = form["password"]

  name = model.authenticate(email, password)
  if name:
    return render_template("dashboard.html", name=name)
  flash("Password and Email invalid. Sucks to be you.")
  return render_template("login.html")
开发者ID:karishay,项目名称:tiny_teacher,代码行数:11,代码来源:views.py


示例19: process_login

def process_login():
    username = request.form.get("username")
    password = request.form.get("password")

    user_id = model.authenticate(username, password)
    if user_id != None:
        flash("User authenticated!")
        session['id'] = user_id
        return redirect(url_for ("view_user", username = username))
    else:
        flash("Password incorrect, there may be a ferret stampede in progress!")
        return redirect(url_for("index"))
开发者ID:KelseyYocum,项目名称:Session-Lesson,代码行数:12,代码来源:app.py


示例20: login

def login():
    email = request.form.get("email")
    password = request.form.get("password")

    user_info = model.authenticate(email, password)
    if user_info != None:
        session['user_id'] = user_info[0]
        session['email'] = user_info[1]
        return redirect("/users/%s" %user_info[0])
    else:
        flash("Your login credentials are not recognized. Sorry!")
        return render_template("index.html")
开发者ID:jordynchuhaloff,项目名称:movie_rating_DB,代码行数:12,代码来源:judgement.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python model.connect函数代码示例发布时间:2022-05-27
下一篇:
Python hooks.call_hooks函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap