[Forntend] 登入 開發機與測試機程序判斷
This commit is contained in:
parent
730654dc66
commit
d943fb3fc5
@ -56,7 +56,7 @@
|
||||
<label class="custom-control-label" for="rememberme"> 記住我</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default float-right" onclick="Login(event)">登入</button>
|
||||
<button type="submit" class="btn btn-default float-right" onclick="Login(null,event)">登入</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="blankpage-footer text-center">
|
||||
@ -118,18 +118,20 @@
|
||||
[
|
||||
"init",
|
||||
|
||||
] ,loadedJsPack);
|
||||
], loadedJsPack);
|
||||
}
|
||||
|
||||
function loadedJsPack() {
|
||||
if (location.href.indexOf("localhost:5966") == -1) {
|
||||
myBaja = new MyBaja();
|
||||
myBaja.setMyUserAccount(Login)
|
||||
}
|
||||
|
||||
if (localStorage.getItem('taipei-t') == 'true') {
|
||||
if (localStorage.getItem('mitsubishi-t') == 'true') {
|
||||
document.getElementById("rememberme").checked = true;
|
||||
remember = true;
|
||||
$("#account").val(atob(localStorage.getItem('taipei-a')));
|
||||
$("#password").val(atob(localStorage.getItem('taipei-p')));
|
||||
$("#account").val(atob(localStorage.getItem('mitsubishi-a')));
|
||||
$("#password").val(atob(localStorage.getItem('mitsubishi-p')));
|
||||
}
|
||||
else {
|
||||
document.getElementById("rememberme").checked = false;
|
||||
@ -167,43 +169,54 @@
|
||||
|
||||
$("#rememberme").click(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('taipei-t', 'false');
|
||||
localStorage.removeItem('taipei-a');
|
||||
localStorage.removeItem('taipei-p');
|
||||
localStorage.setItem('mitsubishi-t', 'false');
|
||||
localStorage.removeItem('mitsubishi-a');
|
||||
localStorage.removeItem('mitsubishi-p');
|
||||
remember = false;
|
||||
} else {
|
||||
localStorage.setItem('taipei-t', 'true');
|
||||
localStorage.setItem('taipei-a', btoa($("#account").val()));
|
||||
localStorage.setItem('taipei-p', btoa($("#password").val()));
|
||||
localStorage.setItem('mitsubishi-t', 'true');
|
||||
localStorage.setItem('mitsubishi-a', btoa($("#account").val()));
|
||||
localStorage.setItem('mitsubishi-p', btoa($("#password").val()));
|
||||
remember = true;
|
||||
}
|
||||
});
|
||||
|
||||
$("#account").change(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('taipei-a', btoa($("#account").val()));
|
||||
localStorage.setItem('mitsubishi-a', btoa($("#account").val()));
|
||||
} else {
|
||||
localStorage.removeItem('taipei-a');
|
||||
localStorage.removeItem('mitsubishi-a');
|
||||
}
|
||||
});
|
||||
|
||||
$("#password").change(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('taipei-p', btoa($("#password").val()));
|
||||
localStorage.setItem('mitsubishi-p', btoa($("#password").val()));
|
||||
} else {
|
||||
localStorage.removeItem('taipei-p');
|
||||
localStorage.removeItem('mitsubishi-p');
|
||||
}
|
||||
});
|
||||
|
||||
function Login(account) {
|
||||
$("#login-form").on("submit", function (e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
|
||||
console.log(account)
|
||||
|
||||
}
|
||||
function Login(account, e) {
|
||||
e ? e.preventDefault() : "";
|
||||
/*if ($("#login-form").valid()) {*/
|
||||
var url = baseApiUrl + "/api/Login/";
|
||||
var send_data = {
|
||||
account: account,
|
||||
password: "rJ2T5Kkj"
|
||||
}
|
||||
if (location.href.indexOf("localhost:5966") != -1) {
|
||||
send_data = {
|
||||
account: $("#account").val(),
|
||||
password: $("#password").val()
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: url,
|
||||
@ -232,8 +245,6 @@
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user