記住我(不要記住我)
This commit is contained in:
parent
1f1851ac5e
commit
3bef3ada9d
@ -84,7 +84,7 @@ namespace SolarPower.Controllers
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
HttpContext.Session.SetString("MyAccount", edFunction.AESEncrypt(user.Account)); //將帳號透過AES加密
|
||||
HttpContext.Session.SetString("CompanyId", edFunction.AESEncrypt(user.CompanyId.ToString())); //將公司id透過AES加密
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ namespace SolarPower.Repository.Implement
|
||||
) b on a.powerStationid = b.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d'') = b.report_date
|
||||
left join
|
||||
( # month
|
||||
SELECT powerStationid, ROUND(AVG(TODAYKWH),2) AS monthKWH,
|
||||
SELECT powerStationid, ROUND(SUM(TODAYKWH),2) AS monthKWH,
|
||||
ROUND(AVG(KWHKWP),2) AS KWHKWP,
|
||||
ROUND(AVG(PR),2) AS PR,
|
||||
ROUND(SUM(MONEY),2) AS money,
|
||||
|
||||
@ -145,3 +145,60 @@
|
||||
<script src="~/js/app.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
//$(document).ready(function () {
|
||||
// var account = Cookies.get('Account');
|
||||
// if (account) {
|
||||
// $('#txtAccount').val(Cookies.get('Account'));
|
||||
// $('#RememberMe').prop("checked", true);
|
||||
// }
|
||||
// else {
|
||||
// $('#RememberMe').prop("checked", false);
|
||||
// }
|
||||
//});
|
||||
var remember = false;
|
||||
$(function () {
|
||||
if (localStorage.getItem('solar-t') == 'true') {
|
||||
document.getElementById("rememberme").checked = true;
|
||||
remember = true;
|
||||
$("#account").val(atob(localStorage.getItem('solar-a')));
|
||||
$("#password").val(atob(localStorage.getItem('solar-p')));
|
||||
}
|
||||
else {
|
||||
document.getElementById("rememberme").checked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#rememberme").click(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('solar-t', 'false');
|
||||
localStorage.removeItem('solar-a');
|
||||
localStorage.removeItem('solar-p');
|
||||
remember = false;
|
||||
} else {
|
||||
localStorage.setItem('solar-t', 'true');
|
||||
localStorage.setItem('solar-a', btoa($("#account").val()));
|
||||
localStorage.setItem('solar-p', btoa($("#password").val()));
|
||||
remember = true;
|
||||
}
|
||||
});
|
||||
|
||||
$("#account").change(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('solar-a', btoa($("#account").val()));
|
||||
} else {
|
||||
localStorage.removeItem('solar-a');
|
||||
}
|
||||
});
|
||||
|
||||
$("#password").change(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('solar-p', btoa($("#password").val()));
|
||||
} else {
|
||||
localStorage.removeItem('solar-p');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user