Authored by 李靖

localStorage

@@ -129,6 +129,7 @@ class Login { @@ -129,6 +129,7 @@ class Login {
129 }, true); 129 }, true);
130 } 130 }
131 validate && validate.type === 2 && validate.refresh(); 131 validate && validate.type === 2 && validate.refresh();
  132 + data.code = 4189;
132 if (data.code === 200) { 133 if (data.code === 200) {
133 res = data.data; 134 res = data.data;
134 135
@@ -136,8 +137,8 @@ class Login { @@ -136,8 +137,8 @@ class Login {
136 location.href = res.href; 137 location.href = res.href;
137 this.view.loginBtn.text('登录成功'); 138 this.view.loginBtn.text('登录成功');
138 } else if (data.code === 4189) { 139 } else if (data.code === 4189) {
139 - localStorage.loginJumpUrl = $('#account').val();  
140 - localStorage.loginJump = 'true'; 140 + window.setCookie('loginJumpUrl', $('input[name=username]').val(), {path: '/passport'});
  141 + window.setCookie('loginJump', true);
141 location.href = data.url; 142 location.href = data.url;
142 } else if (data.code === 510) { 143 } else if (data.code === 510) {
143 location.href = data.url; 144 location.href = data.url;
@@ -97,8 +97,8 @@ function loginAuth(params, acc) { @@ -97,8 +97,8 @@ function loginAuth(params, acc) {
97 location.href = res.href; 97 location.href = res.href;
98 $loginBtn.text('登录成功'); 98 $loginBtn.text('登录成功');
99 } else if (data.code === 4189) { 99 } else if (data.code === 4189) {
100 - localStorage.loginJumpUrl = $('#account').val();  
101 - localStorage.loginJump = 'true'; 100 + window.setCookie('loginJumpUrl', $('input[name=username]').val(), {path: '/passport'});
  101 + window.setCookie('loginJump', true);
102 location.href = data.url; 102 location.href = data.url;
103 } else if (data.code === 510) { 103 } else if (data.code === 510) {
104 location.href = data.url; 104 location.href = data.url;
@@ -176,8 +176,8 @@ $(function() { @@ -176,8 +176,8 @@ $(function() {
176 }); 176 });
177 177
178 // 多次登录失败跳短信认证填充手机号 178 // 多次登录失败跳短信认证填充手机号
179 -if (localStorage.loginJump) { 179 +if (window.cookie('loginJump')) {
180 $('.sms-login .title').text('身份验证'); 180 $('.sms-login .title').text('身份验证');
181 $('.sms-login-msg').before('<p class="sms-login-msg">您的账号存在安全隐患需要进行身份验证</p>'); 181 $('.sms-login-msg').before('<p class="sms-login-msg">您的账号存在安全隐患需要进行身份验证</p>');
182 - localStorage.removeItem('loginJump'); 182 + window.setCookie('loginJump', '');
183 } 183 }
@@ -149,5 +149,5 @@ $(function() { @@ -149,5 +149,5 @@ $(function() {
149 }); 149 });
150 150
151 // 多次登录失败跳短信认证填充手机号 151 // 多次登录失败跳短信认证填充手机号
152 -$('#phone-num').val(localStorage.loginJumpUrl);  
153 -localStorage.removeItem('loginJumpUrl'); 152 +$('#phone-num').val(window.cookie('loginJumpUrl'));
  153 +window.setCookie('loginJumpUrl', '', {path: '/passport'});
@@ -42,8 +42,8 @@ class SmsLoginNew extends Page { @@ -42,8 +42,8 @@ class SmsLoginNew extends Page {
42 this.selector.getVerifyCodeBtn.data('oneClick', false); 42 this.selector.getVerifyCodeBtn.data('oneClick', false);
43 43
44 // 多次登录失败跳短信认证填充手机号 44 // 多次登录失败跳短信认证填充手机号
45 - this.selector.mobileInput.val(localStorage.loginJumpUrl);  
46 - localStorage.removeItem('loginJumpUrl'); 45 + this.selector.mobileInput.val(window.cookie('loginJumpUrl'));
  46 + window.setCookie('loginJumpUrl', '', {path: '/passport'});
47 } 47 }
48 48
49 /** 49 /**