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


Python ChangePasswordForm.validate方法代码示例

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


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

示例1: change_password

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
def change_password():
    form = ChangePasswordForm(request.form)
    if request.method == "POST" and form.validate():
        user = User.query.filter_by(name=g.user.name).first()
        user.password = hash_str(form.password.data)
        user.save()
        return redirect(url_for('user.settings'))
    return redirect(url_for('user.settings'))
开发者ID:linkexf,项目名称:story,代码行数:10,代码来源:user.py

示例2: change_password

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
def change_password():
    if( request.method == "POST"):
        form = ChangePasswordForm( request.form)
        if( form.validate()):
            current_user.set_password( form.password1.data)
            flash( "Your password was changed successfully.", "success")
            return redirect( "/")
    else:
        form = ChangePasswordForm()
    return render_template( "auth/change_password.html", **locals())
开发者ID:seanbradley,项目名称:flask-sauth,代码行数:12,代码来源:views.py

示例3: changepassword

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
def changepassword():
    form = ChangePasswordForm(request.form)
    if request.method == "POST" and form.validate():
        if not current_user.check_password(form.old_password.data):
            form.old_password.errors.append(u"密码错误!")
            return render_template("changepassword.html", form=form)

        current_user.password = User.create_password(form.new_password.data)
        db.session.add(current_user)
        db.session.commit()
        flash(u"密码修改成功!")
        return render_template("changepassword.html", form=ChangePasswordForm())

    return render_template("changepassword.html", form=form)
开发者ID:wq1308786830,项目名称:flaskbbs,代码行数:16,代码来源:views.py

示例4: change_password

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
def change_password():
    '''
    Change a user's password
    '''
    form = ChangePasswordForm(request.form)
    if request.method == 'POST' and form.validate():
        if current_user.check_password(form.old_password.data):
            current_user.update_password(form.new_password.data)
            current_user.save()
            flash("Your password has been updated.", category='index_page')
            return redirect(url_for('.list_projects'))
        else:
            flash("Your password does not match.", category='error')
            return render_template('change_password.html', form=form)    
    return render_template('change_password.html', form=form)
开发者ID:YongHoJang,项目名称:GeoTagger-Server,代码行数:17,代码来源:views.py

示例5: changepassword

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
def changepassword():
  form = ChangePasswordForm()

  if 'Members_Email' not in session:
    return redirect(url_for('signin'))
 
   
  if request.method == 'POST':
    if form.validate() == False:
      return render_template('changepassword.html', form=form)
    else:   
      test = User.query.filter_by(Members_Email = session['Members_Email']).first()
      test.Members_Passhash = update_password(form.Members_Password.data)
      db.session.add(test)
      db.session.commit()
      return redirect(url_for('profile'))
                 
  elif request.method == 'GET':
    return render_template('changepassword.html', form=form)  
开发者ID:TechQuity,项目名称:milk2,代码行数:21,代码来源:routes.py

示例6: post

# 需要导入模块: from forms import ChangePasswordForm [as 别名]
# 或者: from forms.ChangePasswordForm import validate [as 别名]
    def post(self):
        old_password = self.get_argument("old_password")
        new_password = self.get_argument("new_password")
        confirm_password = self.get_argument("confirm_password")

        form = ChangePasswordForm(self.request.arguments)

        password_error = password_validation(self.session, self.uid,
                old_password)

        if form.validate():
            if password_error == "":
                change_password(self.session, self.uid, new_password)
                self.redirect("/")
            else:
                self.render("changepassword.html", username=self.username,
                        group=self.group, form=form, db_error=password_error)
        else:
            self.render("changepassword.html", username=self.username,
                    group=self.group, form=form, db_error=None)
开发者ID:alioth310,项目名称:cipher,代码行数:22,代码来源:user.py


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