fix(#I135E7): 关闭 Mobile 认证后用户密码登录方式失效

#Comment
comment #I135E7

#Issue
close https://gitee.com/LongbowEnterprise/dashboard/issues?id=I135E7
This commit is contained in:
Argo Zhang 2019-10-10 11:23:06 +08:00
parent e062001953
commit e6966886df
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 39 additions and 36 deletions

View File

@ -134,46 +134,49 @@
$login.find('[name="userName"], [name="password"]').attr('data-valid', 'false'); $login.find('[name="userName"], [name="password"]').attr('data-valid', 'false');
} }
$login.on('submit', function (e) { var $loginType = $('#loginType');
var model = $loginType.attr('data-value'); if ($loginType.length === 1) {
if (model === 'username') { $login.on('submit', function (e) {
if ($username.val() === '' && $password.val() === '') { var model = $loginType.attr('data-value');
e.preventDefault(); if (model === 'username') {
location.href = "Gitee"; if ($username.val() === '' && $password.val() === '') {
e.preventDefault();
location.href = "Gitee";
}
} }
} else {
else { // sms
// sms var url = $.format('Account/Mobile{0}', location.search);
var url = $.format('Account/Mobile{0}', location.search); $login.attr('action', $.formatUrl(url));
$login.attr('action', $.formatUrl(url)); return true;
return true; }
} });
});
// login type // login type
var $loginType = $('#loginType').on('click', function (e) { $loginType.on('click', function (e) {
e.preventDefault(); e.preventDefault();
var $this = $(this); var $this = $(this);
$login.find('[data-toggle="tooltip"]').tooltip('hide'); $login.find('[data-toggle="tooltip"]').tooltip('hide');
var model = $this.attr('data-value'); var model = $this.attr('data-value');
if (model === 'username') { if (model === 'username') {
$loginUser.addClass('d-none'); $loginUser.addClass('d-none');
$loginPwd.addClass('d-none'); $loginPwd.addClass('d-none');
$loginSMS.removeClass('d-none'); $loginSMS.removeClass('d-none');
$loginMobile.removeClass('d-none'); $loginMobile.removeClass('d-none');
$this.attr('data-value', 'sms').text('用户名密码登陆'); $this.attr('data-value', 'sms').text('用户名密码登陆');
} }
else { else {
// sms model // sms model
$loginUser.removeClass('d-none'); $loginUser.removeClass('d-none');
$loginPwd.removeClass('d-none'); $loginPwd.removeClass('d-none');
$loginSMS.addClass('d-none'); $loginSMS.addClass('d-none');
$loginMobile.addClass('d-none'); $loginMobile.addClass('d-none');
$this.attr('data-value', 'username').text('短信验证登陆'); $this.attr('data-value', 'username').text('短信验证登陆');
} }
}); });
}
var timeHanlder = null; var timeHanlder = null;
$('#btnSendCode').on('click', function () { $('#btnSendCode').on('click', function () {