本文整理汇总了Python中users.User.password方法的典型用法代码示例。如果您正苦于以下问题:Python User.password方法的具体用法?Python User.password怎么用?Python User.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.User
的用法示例。
在下文中一共展示了User.password方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import password [as 别名]
def register(session):
code = session.query(RegistrationCode).filter_by(value=request.form['code']).scalar()
if code is not None:
email_address = request.form['email']
user = User()
user.username = request.form['username']
password = generate_password()
user.password = password
user.email = email_address
user.role = 'user'
session.add(user)
session.delete(code)
send_mail('registration_email.html', 'Przenieś to potem gdzieś', email_address, password=password, username=user.username)
result = 'ok'
else:
result = 'wrong_code'
return render_template('register.html', result=result)
示例2: signup
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import password [as 别名]
def signup():
if current_user.is_authenticated():
return redirect(url_for('user.index'))
loginForm = LoginForm()
form = SignupForm(next=request.args.get('next'))
if form.validate_on_submit():
user = User()
user.email = form.email.data.strip()
user.name = form.name.data.strip()
user.password = form.password.data
user.save()
if login_user(user):
return redirect(form.next.data or url_for('users.index'))
return render_template('frontend/login.html',
loginForm=loginForm,
signupForm=form)
示例3: create_profile
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import password [as 别名]
def create_profile():
if current_user.is_authenticated():
return redirect(url_for('users.index'))
form = CreateProfileForm()
if form.validate_on_submit():
user = User()
user.email = form.email.data.strip()
user.password = form.password.data
user.github_id = session['github_id']
user.name = session['name']
user.github_username = session['github_username']
user.oauth_token = session['oauth_token']
user.location = session['location']
user.save()
if login_user(user):
flash(_("Logged in"), 'success')
return redirect(url_for('users.index'))
return render_template('frontend/create_profile.html',
form=form)