Jira Code: VG-33
Implement the “Remember Me” feature in SCA login-registration page. If the new user checks the checkbox on the registration page, the username will be stored, and it will automatically populate in the corresponding input box during the next user-level. A cookie is used to store the user name.
<script>
$(function() {
/*check username exist in coockie*/
if ($.cookie('username')) {
/*get username*/
var Setusername = $.parseJSON($.cookie("username"));
/* set username into div*/
$("#login-email").val(Setusername);
/* alert("Setusername true");*/
}
/*check password exist in coockie*/
if ($.cookie('password')) {
/*get password*/
var Setpassword = $.parseJSON($.cookie("password"));
/* set password into div*/
$("#login-password").val(Setpassword);
}
/*Submit Button Click*/
$('.login-register-login-submit').mouseover(function() {
/* if checkbox is checked*/
if ($("#RememberMe").prop('checked') == true) {
/*username*/
var username = $('#login-email').val();
/* console.log("username", username);*/
/*if username is alaready set in cookie*/
if ($.cookie('username')) {
/*remove username*/
$.removeCookie('username');
}
/* set current username*/
$.cookie("username", JSON.stringify(username), { expires: 14 });
var CoockieUsername = $.parseJSON($.cookie("username"));
/* password*/
var password = $('#login-password').val();
/*if password is alaready set in cookie*/
if ($.cookie('password')) {
/*remove password*/
$.removeCookie('password');
}
/* set current password*/
$.cookie("password", JSON.stringify(password), { expires: 14 });
var CoockiePassword = $.parseJSON($.cookie("password"));
/* if checkbox is not checked*/
} else {
/* if username is set in cookie*/
if ($.cookie('username')) {
/*remove username*/
$.removeCookie('username');
}
/* if password is set in cookie*/
if ($.cookie('password')) {
/*remove password*/
$.removeCookie('password');
}
}
});
});
</script>