From dfd6bb9608a92b7bbeb6f0c38ec5a25b0f9a46bd Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 27 Jun 2021 08:44:00 +0100 Subject: [PATCH] :bug: Re: #70 - Error on login form when remember me is set to never --- src/utils/Auth.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/Auth.js b/src/utils/Auth.js index 88e15d12..57e519f8 100644 --- a/src/utils/Auth.js +++ b/src/utils/Auth.js @@ -69,7 +69,8 @@ export const login = (username, pass, timeout) => { const now = new Date(); const expiry = new Date(now.setTime(now.getTime() + timeout)).toGMTString(); 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); };