Recovering Credentials
We will create and autoLogin
method in Auth.js
to recover credentials. Remember to call this method when the page load:
autoLogin: async () => {
if (window.PasswordCredential) {
const credentials = await navigator.credentials.get({ password: true });
try {
document.getElementById("login_email").value = credentials.id;
document.getElementById("login_password").value = credentials.password;
Auth.login();
} catch (e) {}
}
},