|
|
@@ -122,6 +122,39 @@
|
|
|
</section>
|
|
|
</div>
|
|
|
<script>
|
|
|
+ var thecookie = getCookieByName('auto_login');
|
|
|
+ if(!thecookie) {
|
|
|
+ document.getElementById("password").setAttribute("autocomplete", "new-password");
|
|
|
+ } else {
|
|
|
+ document.getElementById("password").setAttribute("autocomplete", "on");
|
|
|
+ document.getElementById("RememberMe").setAttribute("checked", "true");
|
|
|
+ }
|
|
|
+
|
|
|
+ function createCookie(name,value,days) {
|
|
|
+ document.cookie = name+'='+value+'; max-age='+days;
|
|
|
+ }
|
|
|
+
|
|
|
+ function parseCookie() {
|
|
|
+ var cookieObj = {};
|
|
|
+ var cookieAry = document.cookie.split(';');
|
|
|
+ var cookie;
|
|
|
+
|
|
|
+ for (var i=0, l=cookieAry.length; i<l; ++i) {
|
|
|
+ cookie = jQuery.trim(cookieAry[i]);
|
|
|
+ cookie = cookie.split('=');
|
|
|
+ cookieObj[cookie[0]] = cookie[1];
|
|
|
+ }
|
|
|
+ return cookieObj;
|
|
|
+ }
|
|
|
+
|
|
|
+ function getCookieByName(name) {
|
|
|
+ var value = parseCookie()[name];
|
|
|
+ if (value) {
|
|
|
+ value = decodeURIComponent(value);
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
function refresh_code() {
|
|
|
document.getElementById("imageCode").src = "./script/php/captcha.php";
|
|
|
}
|
|
|
@@ -176,6 +209,10 @@
|
|
|
success: function (data) {
|
|
|
if (data == "success") {
|
|
|
document.location.href = "index.php";
|
|
|
+
|
|
|
+ if(document.getElementById("RememberMe").checked) {
|
|
|
+ createCookie('auto_login','true','2592000');
|
|
|
+ }
|
|
|
} else {
|
|
|
document.getElementById("errorString").innerHTML =
|
|
|
data;
|