🔀 Merge pull request #71 from Lissy93/BUG-FIX_login-timeout

Fixes #70 - Error on login when Remember Me is set to Never
This commit is contained in:
Alicia Sykes 2021-06-27 08:49:22 +01:00 committed by GitHub
commit 623f67202e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -69,7 +69,8 @@ export const login = (username, pass, timeout) => {
const now = new Date(); const now = new Date();
const expiry = new Date(now.setTime(now.getTime() + timeout)).toGMTString(); const expiry = new Date(now.setTime(now.getTime() + timeout)).toGMTString();
const userObject = { user: username, hash: sha256(pass).toString().toLowerCase() }; const userObject = { user: username, hash: sha256(pass).toString().toLowerCase() };
document.cookie = `authenticationToken=${generateUserToken(userObject)}; expires=${expiry}`; document.cookie = `authenticationToken=${generateUserToken(userObject)};`
+ `${timeout > 0 ? `expires=${expiry}` : ''}`;
localStorage.setItem(localStorageKeys.USERNAME, username); localStorage.setItem(localStorageKeys.USERNAME, username);
}; };