本文整理汇总了Python中lib.User.User.get方法的典型用法代码示例。如果您正苦于以下问题:Python User.get方法的具体用法?Python User.get怎么用?Python User.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.User.User
的用法示例。
在下文中一共展示了User.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: admin
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def admin():
status = ["default", "none"]
if Configuration.loginRequired():
if not current_user.is_authenticated():
return render_template('login.html', status=status)
else:
return render_template('admin.html', status=status, stats=adminStats())
else:
person = User.get("_dummy_")
login_user(person)
return render_template('admin.html', status=status, stats=adminStats())
示例2: login_check
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def login_check():
# validate username and password
username = request.form.get('username')
password = request.form.get('password')
person = User.get(username)
try:
if person and pbkdf2_sha256.verify(password, person.password):
login_user(person)
return render_template('admin.html', status=["logged_in", "success"], stats=adminStats())
else:
return render_template('login.html', status=["wrong_combination", "warning"])
except:
return render_template('login.html', status=["outdated_database", "error"])
示例3: login_check
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def login_check():
# validate username and password
username = request.form.get('username')
password = request.form.get('password')
person = User.get(username)
try:
if person and pbkdf2_sha256.verify(password, person.password):
login_user(person)
return render_template('admin.html', status="logged_in", **adminInfo())
else:
return render_template('login.html', status="wrong_user_pass")
except:
return render_template('login.html', status="outdated_database")
示例4: admin
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def admin():
if Configuration.loginRequired():
if not current_user.is_authenticated():
return render_template('login.html')
else:
person = User.get("_dummy_")
login_user(person)
output = None
if os.path.isfile(Configuration.getUpdateLogFile()):
with open(Configuration.getUpdateLogFile()) as updateFile:
separator="==========================\n"
output=updateFile.read().split(separator)[-2:]
output=separator+separator.join(output)
return render_template('admin.html', status="default", stats=adminStats(), updateOutput=filterUpdateField(output))
示例5: login_check
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def login_check(self):
# validate username and password
username = request.form.get('username')
password = request.form.get('password')
person = User.get(username, self.auth_handler)
try:
if person and person.authenticate(password):
login_user(person)
return render_template('admin.html', status="logged_in", **self.adminInfo())
else:
return render_template('login.html', status="wrong_user_pass")
except Exception as e:
print(e)
return render_template('login.html', status="outdated_database")
示例6: load_user
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def load_user(id):
return User.get(id)
示例7: load_user
# 需要导入模块: from lib.User import User [as 别名]
# 或者: from lib.User.User import get [as 别名]
def load_user(self, id):
return User.get(id, self.auth_handler)