修正:使用google二次验证码登录时不能如果验证码以0开头会无法登录;

修正:使用MySQL数据库时,主机运维界面的模糊查找可能会导致web服务崩溃;
pull/105/head
Apex Liu 2018-09-02 16:46:46 +08:00
parent 181b71fa8e
commit ea9c3135d1
2 changed files with 23 additions and 8 deletions

View File

@ -107,9 +107,9 @@ $app.on_init = function (cb_stack) {
}
});
if($app.options.default_auth & TP_LOGIN_AUTH_USERNAME_PASSWORD_CAPTCHA) {
if ($app.options.default_auth & TP_LOGIN_AUTH_USERNAME_PASSWORD_CAPTCHA) {
$app.dom.btn_login_type_password.click();
} else if($app.options.default_auth & TP_LOGIN_AUTH_USERNAME_PASSWORD_OATH) {
} else if ($app.options.default_auth & TP_LOGIN_AUTH_USERNAME_PASSWORD_OATH) {
$app.dom.btn_login_type_oath.click();
}
@ -156,7 +156,17 @@ $app.login_account = function () {
return;
}
} else if ($app.login_type === TP_LOGIN_AUTH_USERNAME_PASSWORD_OATH) {
if (str_oath.length !== 6 || ('' + parseInt(str_oath)) !== str_oath) {
var test_oath = '' + parseInt(str_oath);
if(str_oath.length === 6) {
for (; ;) {
if (test_oath.length < 6)
test_oath = '0' + test_oath;
else
break;
}
}
if (str_oath.length !== 6 || test_oath !== str_oath) {
$app.show_op_box('error', '身份验证器动态验证码错误!');
setTimeout(function () {
$app.dom.input_oath.attr('data-content', "身份验证器动态验证码为6位数字请重新填写").focus().select().popover('show');
@ -235,12 +245,12 @@ $app.init_blur_bg = function () {
setInterval($app._update_blur_bg, 20500);
setTimeout(function(){
setTimeout(function () {
$app.init_slogan();
}, 2000);
setTimeout(function(){
$app.dom.auth_box.fadeIn(800, function(){
setTimeout(function () {
$app.dom.auth_box.fadeIn(800, function () {
$app.dom.input_username.focus();
});
}, 300);

View File

@ -200,9 +200,12 @@ class TPDatabase:
log.e('Unknown database type.\n')
return None
def query(self, sql, args=()):
def query(self, sql, args=None):
if self.need_create:
return None
if self.db_type == self.DB_TYPE_SQLITE and args is None:
args = ()
# log.d('[db] {}, {}\n'.format(sql, args))
# _start = datetime.datetime.utcnow().timestamp()
ret = self._conn_pool.query(sql, args)
@ -210,7 +213,9 @@ class TPDatabase:
# log.d('[db] cost {} seconds.\n'.format(_end - _start))
return ret
def exec(self, sql, args=()):
def exec(self, sql, args=None):
if self.db_type == self.DB_TYPE_SQLITE and args is None:
args = ()
# log.d('[db] {}\n'.format(sql, args))
# print('[db]', sql, args)
# _start = datetime.datetime.utcnow().timestamp()