mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-26 18:36:36 +03:00
🥅 Catch error if incorrectly configured user
This commit is contained in:
parent
04082763d3
commit
fd99837b78
@ -39,6 +39,10 @@ const getUsers = () => {
|
||||
* @returns {String} The hashed token
|
||||
*/
|
||||
const generateUserToken = (user) => {
|
||||
if (!user.user || !user.hash) {
|
||||
ErrorHandler('Invalid user object. Must have `user` and `hash` parameters');
|
||||
return undefined;
|
||||
}
|
||||
const strAndUpper = (input) => input.toString().toUpperCase();
|
||||
const sha = sha256(strAndUpper(user.user) + strAndUpper(user.hash));
|
||||
return strAndUpper(sha);
|
||||
|
Loading…
Reference in New Issue
Block a user