本文整理汇总了Python中autonomie.models.user.User.set_password方法的典型用法代码示例。如果您正苦于以下问题:Python User.set_password方法的具体用法?Python User.set_password怎么用?Python User.set_password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autonomie.models.user.User
的用法示例。
在下文中一共展示了User.set_password方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_account
# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import set_password [as 别名]
def test_account(self):
a = User(**TEST1)
a.set_password('pwd')
self.assertTrue(a.auth("pwd"))
strange = "#;\'\\\" $25; é ö ô è à ù"
a.set_password(strange)
self.assertFalse(a.auth("pwd"))
self.assertTrue(a.auth(strange))
示例2: adduser
# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import set_password [as 别名]
def adduser(dbsession):
user = User(login='test_forms_user',
lastname='lastname__éé',
firstname='firstname__éé')
user.set_password(u"Tést$!Pass")
dbsession.add(user)
dbsession.flush()
return user
示例3: add_user
# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import set_password [as 别名]
def add_user(login, password, group, firstname="", lastname=""):
user = User(login=login, firstname=firstname, lastname=lastname)
user.set_password(password)
user.primary_group = group
session = DBSESSION()
session.add(user)
session.flush()
group_name = GROUPS[group]
print "Added %s: %s/%s" % (group_name, login, password)
return user
示例4: add_admin
# 需要导入模块: from autonomie.models.user import User [as 别名]
# 或者: from autonomie.models.user.User import set_password [as 别名]
def add_admin(arguments, env):
"""
Add an admin user to the database
"""
login = get_value(arguments, 'user', 'admin.majerti')
password = get_value(arguments, 'pwd', get_pwd())
firstname = get_value(arguments, 'firstname', 'Admin')
lastname = get_value(arguments, 'lastname', 'Majerti')
email = get_value(arguments, 'email', '[email protected]')
user = User(login=login,
firstname=firstname,
primary_group=1, #is an admin
lastname=lastname,
email=email
)
user.set_password(password)
db = DBSESSION()
db.add(user)
db.flush()
print u"Creating account %s with password %s" % (login, unicode(password))
return user