本文整理汇总了Python中model.user.User.check_password方法的典型用法代码示例。如果您正苦于以下问题:Python User.check_password方法的具体用法?Python User.check_password怎么用?Python User.check_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.check_password方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_makecheck_password
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import check_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'))
示例2: login
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import check_password [as 别名]
def login():
if request.method == "GET":
return render_template("admin/login.html")
username, password = map(request.form.get, ("username", "password"))
has_user = User.has_user(g.db, username)
if has_user:
check_password = User.check_password(g.db, username, password)
if check_password:
session["username"] = username
return redirect("/admin")
else:
return jsonify(status=400, message=u'密码错误')
return jsonify(status=400, message=u'用户名错误')
示例3: test_check_password
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import check_password [as 别名]
def test_check_password(self):
d = dict(email="[email protected]", password="1234", password2="1234")
yield User.insert(**d)
assert (yield User.check_password(d['email'], d['password'])) == True
assert (yield User.check_password(d['email'], '')) == False
yield User.col.remove({'email': d['email']})
示例4: print
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import check_password [as 别名]
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',
'host3.domain.com',
],
'whitelist': {
'bingbot': '157.55.0.0/16',