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


Python User.email方法代码示例

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


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

示例1: register

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import email [as 别名]
def register():
	if 'username' in session:
		flash("Cannot create new account while logged in.")
		return redirect(url_for('hello'))
	else:	
		form = RegistrationForm()
	
		if form.validate_on_submit():
			login = form.username.data
			user = dbsession.query(User).filter_by(name=login).first()
		
			if user is None:
				pw_hash = bcrypt.generate_password_hash(form.password.data)
				user = User(login, '', pw_hash)
				user.gender = form.gender.data
				user.species = form.species.data
				user.bio = form.bio.data
				user.email = form.email.data
				user.minorflag = not form.adult.data
				user.accepttos = True
				
				dbsession.add(user)
				dbsession.commit()

				flash("User Created")
				return redirect(url_for('login'))
			else:
				flash("User already exists.")
				return redirect(url_for('register'))
		
	return render_template('register.html', form=form)
开发者ID:Aerdan,项目名称:SpiderSilk,代码行数:33,代码来源:app.py

示例2: r_success

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import email [as 别名]
def r_success():
    nickname = request.form["nickname"]
    email = request.form["email"]
    passwd = request.form["passwd"]
    repasswd = request.form["repasswd"]
    if passwd != repasswd:
        return "비밀번호가 다릅니다."
    if len(passwd) < 8:
        return """
             <script>
             alert("비밀번호를 8자리 이상 적어주세요.");
            history.back();
             </script>
        """
    if not len(email) or not len(nickname):
        return """
             <script>
             alert("모두 채워 주세요.");
            history.back();
             </script>
            """
    if is_already_registered(email, nickname) == 2:
        return "메일"
    if is_already_registered(email, nickname) == 3:
        return "별명"
    new = User()
    new.nickname = nickname
    new.email = email
    new.pw = passwd
    db.session.add(new)
    db.session.commit()
    return render_template("index.html")
开发者ID:HJeongWon,项目名称:InDieFo,代码行数:34,代码来源:test.py

示例3: updateUser

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import email [as 别名]
def updateUser(cookie, uid, handle, name, pwd, admin, email):
    session = Session()
    u = usermanagment.getUser(cookie)
    if not u.admin and uid != u.id:
        raise Exception("Invalid access %s %s" % (uid, u.id))
    if uid == -1:
        cu = User(handle)
        session.add(cu)
    else:
        q = session.query(User).filter_by(id=uid)
        if q.count() == 0:
            raise Exception("User not found")
        cu = q.one()
    cu.name = name
    cu.email = email
    if pwd:
        cu.password = pwd
    if u.admin:
        cu.admin = admin
    session.commit()
    return cu.id
开发者ID:antialize,项目名称:djudge,代码行数:23,代码来源:rpc.py

示例4: addupdate_user

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import email [as 别名]
def addupdate_user(fb_user, email, access_token, auth_code):
    
    from db import db, User
    
    new = False
    user = get_user_from_email(email)
    if not user:
        new = True
        user = User()
        
    user.facebook_user_id = fb_user
    user.email = email
    user.auth_code = auth_code
    user.access_token = access_token
        
    db.session.add(user)
    db.session.commit()
    
    if new:
        create_demo_checkpoints(user)
    
    return user
开发者ID:nubela,项目名称:spawt-backend,代码行数:24,代码来源:user.py

示例5: range

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import email [as 别名]
# $2a$12$/xOeN.4B6wQsen5TgvOAMOUVvETJ8vDC8WqhjHRF2OYGSslxMmB2O


if __name__ == '__main__':
	password = '$2a$12$/xOeN.4B6wQsen5TgvOAMOUVvETJ8vDC8WqhjHRF2OYGSslxMmB2O'

	from db import User, Story, addDefault, refresh_db, session as dbsession
	import random
	import loremipsum

	for adduser in range(1,1000):
		username = "User%s" % (adduser)
		user = User(username,'',password)
		user.species = 'Automatic'
		user.bio = 'Automatic bio'
		user.email = '[email protected]'
		user.minorflag = True
		user.accepttos =True
		dbsession.add(user)
		dbsession.commit()

	for addstories in range(1,20000):
		newstory = Story(loremipsum.generate_sentence()[2])
		newstory.text = loremipsum.generate_paragraph()[2]
		newstory.adult = True
		newstory.uid = random.randrange(1000)+1
		dbsession.add(newstory)
		dbsession.commit()


开发者ID:Aerdan,项目名称:SpiderSilk,代码行数:30,代码来源:seeddatabase.py


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