本文整理汇总了Python中model.user.User.password方法的典型用法代码示例。如果您正苦于以下问题:Python User.password方法的具体用法?Python User.password怎么用?Python User.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.password方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_new_user
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
def create_new_user(self, user_keyname, password, set_user=True, **kwargs):
logging.info('creating user with keyname %s' % user_keyname)
user_entity = User(key_name=user_keyname, username=user_keyname)
if password:
user_entity.password = password
if '@passtiche.appspot.com' not in user_keyname and not user_keyname.startswith('auto_gen'):
deferred.defer(send_admin_email, subject='New %s User: %s' % (
self._settings['title'], user_keyname),
message='User %s just signed up for an account' % user_keyname,
user=user_keyname, user_agent=gae_utils.GetUserAgent(), url=gae_utils.GetUrl())
if '@' in user_keyname:
user_entity.email = user_keyname
#send_welcome_email(user_entity.email, 'Welcome to %s!' % self._settings['title'])
deferred.defer(send_welcome_email,
user_entity,
'Welcome to %s!' % self._settings['title'],
_countdown=10) # 1300 22 minutes
# optional args
for k in ['first_name', 'last_name','phone','organization']:
if kwargs.get(k):
v = kwargs.get(k)
setattr(user_entity, k, v)
from utils import string as str_utils
code = str_utils.genkey(length=7)
user_entity.short_code = code
user_entity.put()
if set_user:
self.set_current_user(user_entity)
return user_entity
示例2: get
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
def get(self):
user = User()
user.email = ""
user.password = ""
user.name=""
user.password_confirm = ""
return self.render('setting_add_user.html', user_name="", user=user, errors={})
示例3: test_makecheck_password
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
def test_makecheck_password(self):
user = User(self.complete_data)
password = user.make_password('secret')
ok_(isinstance(password, str))
ok_(len(password) > 10)
eq_('secret', user.password) # still not changed
user.password = password
ok_(user.check_password('secret'))
示例4: post
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
def post(self):
email = self.get_argument('email','')
user_name = self.get_argument('user_name','')
password = self.get_argument('password','')
password_confirm = self.get_argument('password_confirm','')
user = User()
user.email = email
user.name = user_name
user.password = password
user.password_confirm = password_confirm
user_id = user.create()
if not user_id:
return self.render('register.html', user_name="", user=user, errors=user.errors)
#return self.send_error_json(user.errors)
else:
self.redirect('/login')
示例5: register_view
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
def register_view(self):
form = RegistrationForm(request.form)
if helpers.validate_form_on_submit(form):
user = User()
form.populate_obj(user)
# we hash the users password to avoid saving it as plaintext in the db,
# remove to use plain text:
user.password = generate_password_hash(form.password.data)
db.session.add(user)
db.session.commit()
login.login_user(user)
return redirect(url_for('.index'))
link = '<p>Already have an account? <a href="' + url_for('.login_view') + '">Click here to log in.</a></p>'
self._template_args['form'] = form
self._template_args['link'] = link
return super(MyAdminIndexView, self).index()
示例6: User
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
"""
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! !!!
!!! VERY IMPORTANT !!!
!!! CHANGE ADMIN PASSWORD BEFORE INSTALL !!!
!!! !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"""
admin_user = User("admin", u"webmaster", sha256("asdf1234").hexdigest(), u"웹마스터", None, None, None, admin.uid, None)
admin_user.is_admin = True
admin.users.append(admin_user)
anybody.users.append(admin_user)
dbsession.add(admin_user)
chat_user = User("chat_system", "system", "asdf", "system", None, None, None, admin.uid, None)
chat_user.password = ""
anybody.users.append(chat_user)
dbsession.add(chat_user)
dbsession.commit()
"""
BASIC REQUIREMENT TO HERE
"""
"""
FOR POOLC FROM HERE
"""
game_dev = Group(u"게임제작부")
dbsession.add(game_dev)
hakbeons = ["14", "13", "12", "11", "10", "09", "08", "07", "06", "05", "04", "03", "02", "01", "00", "99", "98"]
示例7: AerospikeSession
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import password [as 别名]
session = AerospikeSession(**settings['aerospike'])
print("Creating indexes..."),
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'user', 'name', 'idx_name')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'user', 'private_token', 'idx_private_token')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'auth', 'token', 'idx_token')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'project', 'full_name', 'idx_full_name')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'project', 'user', 'idx_projectuser')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'example', 'p_interval', 'idx_interval')
session.aerospike.index_string_create(settings['aerospike']['namespace'], 'example', 'ip_address', 'idx_ip')
print("ok")
print("Creating user..."),
user = User({'name': 'jmpeso', 'email': '[email protected]'})
user.password = user.make_password('1234')
session.add(user)
print('ok (auth token for {0} is {1})'.format(user.name, user.private_token))
assert user.check_password('1234')
print("Creating project..."),
project = Project({
'user': 'jmpeso',
'name': 'my_project',
'logformat': 'ApacheCombinedFormat',
'logdir': '/opt/data/',
'logpattern': 'myproject-files-*',
'hosts': [
'host1.domain.com',
'host2.domain.com',