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


Python User.password方法代码示例

本文整理汇总了Python中auth.models.User.password方法的典型用法代码示例。如果您正苦于以下问题:Python User.password方法的具体用法?Python User.password怎么用?Python User.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth.models.User的用法示例。


在下文中一共展示了User.password方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: signup

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
def signup():
    if request.method == "POST":
        username = request.form["username"]
        password = request.form["password"]
        verify = request.form["verify"]
        email = request.form["email"]

        if valid_username(username) and valid_password(password)\
                and valid_email(email) and password == verify:
                user = User(username=username, email=email)
                user.password = password
                for exist in User.objects(username=username):
                    if user.username == exist.username:
                        flash(u"Username or Email already exist!!")
                        return redirect("/login")
                for exist in User.objects(email=email):
                    if user.email == exist.email:
                        flash(u"Username or Email already exist!!")
                        return redirect("/login")
                user.save()
                login_user(user)
                return redirect("/wiki/home")
        else:
            flash(u"Invalid Username or Password or Email!!")
            return redirect("/signup")

    return render_template("/auth/signup.html")
开发者ID:anjiannian,项目名称:wiki-flask,代码行数:29,代码来源:views.py

示例2: other_user

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
def other_user():
    from auth.models import User
    user = User()
    user.username = 'Luke_Skywalker'
    user.email = '[email protected]'
    user.password = user.generate_password(password='12345678')
    user.save(commit=True)
    return user
开发者ID:maxnovais,项目名称:flapy_auth,代码行数:10,代码来源:conftest.py

示例3: user

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
def user():
    from auth.models import User
    user = User()
    user.username = 'Darth_Vader'
    user.email = '[email protected]'
    user.password = user.generate_password(password='12345678')
    user.save(commit=True)
    return user
开发者ID:maxnovais,项目名称:flapy_auth,代码行数:10,代码来源:conftest.py

示例4: post

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
 def post(self, *args, **kw):
     form = request.form
     try:
         new_user = User(username=form['username'], email=form['email'], role=Role.objects(name="User").first())
         new_user.password = form['password']
         new_user.save()
     except NotUniqueError, e:  # email or username is not unique
         if re.match(r'.*\$email.*', str(e)):
             return jsonify(status="not-unique", message=u"Email has already confirmed.")
         elif re.match(r'.*\$username.*', str(e)):
             return jsonify(status="not-unique", message=u"Username has already confirmed.")
开发者ID:Atober,项目名称:spellworks,代码行数:13,代码来源:views.py

示例5: post

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
 def post(self):
     from auth.models import User
     form = self._form()
     if form.validate():
         email = form.email.data
         pw = form.password.data
         u = User(email=email)
         u.password = pw
         login_user(u)
         self.flash("Thank you for signing up {}".format(email))
         return self.redirect('core.index')
     return self.redirect('auth.signup')
开发者ID:erhuabushuo,项目名称:flask-xxl,代码行数:14,代码来源:views.py

示例6: register_do

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
def register_do(request):
	password = request.GET.get('password')
	password_repeat = request.GET.get('password_repeat')
	if password != password_repeat:
		return HttpResponseRedirect('/auth/register')
	logging.info( password)
	logging.info( password_repeat)

	user = User()
	user.username = request.GET.get('name')
	user.password = request.GET.get('password')
	user.email = request.GET.get('email')
	user.mobile = request.GET.get('mobile')
	user.save()
	return HttpResponseRedirect('/auth/login')
开发者ID:paullzn,项目名称:paullzn,代码行数:17,代码来源:views.py

示例7: post

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
 def post(self):
     from flask_xxl.apps.auth.models import User
     form = self._form()
     if form.validate():
         email = form.email.data
         pw = form.password.data
         u = User(email=email)
         u.password = pw
         try:
             u.save()
             login_user(u)
             self.flash("Thank you for signing up {}".format(email),'success')
             return self.redirect('core.index')
         except:
             self.flash("an error occured while updating the database","danger")                
     return self.redirect('auth.signup')
开发者ID:Kolab-Education,项目名称:flask-ide,代码行数:18,代码来源:views.py

示例8: login

# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import password [as 别名]
def login():
    password = request.form.get('inputPassword')
    username = request.form.get('inputUsername')
    user = User()
    user.username = username
    user.password = password
    remember = False
    if request.form.get('remember_me') == 'on':
        remember = True
    login_user(user, remember=remember)
    rest = Rest()
    user.other = rest.get('/auth/user')
    # login_user(user, remember=remember)
    if user.other.get('message'):
        flash(user.other.get('message'), 'error')
        logout_user()
    return redirect(request.form.get('request_url'))
开发者ID:emin100,项目名称:barmanUI,代码行数:19,代码来源:controllers.py


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