Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:goal_net: Catch error if incorrectly configured user

Alicia Sykesfd99837b78a1
diff --git a/src/utils/Auth.js b/src/utils/Auth.js
index fb0eab2c..df9f3478 100644
--- a/src/utils/Auth.js
+++ b/src/utils/Auth.js
@@ -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);