Compare commits

...

2 Commits

Author SHA1 Message Date
Kayne Ruse 267ecaa705 Added a typecheck to password field 2023-05-15 08:03:54 +10:00
Kayne Ruse 3a8cfd39ed BUGFIX: force a logout if refresh token is too old 2023-05-05 03:56:24 +10:00
4 changed files with 12 additions and 3 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "auth-server",
"version": "1.7.2",
"version": "1.7.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "auth-server",
"version": "1.7.2",
"version": "1.7.4",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "auth-server",
"version": "1.7.3",
"version": "1.7.4",
"description": "An API centric auth server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js",
"scripts": {
+4
View File
@@ -83,6 +83,10 @@ const validateDetails = async (body) => {
return 'Missing password';
}
if (typeof body.password != "string") {
return 'Invalid password';
}
if (body.password.length < 8) {
return 'Password too short';
}
+5
View File
@@ -25,6 +25,11 @@ const TokenProvider = props => {
localStorage.setItem("accessToken", accessToken);
}, [accessToken]);
//force a logout if refresh token is too old
if (accessToken && (new Date(Date.now() - 60 * 60 * 24 * 30 * 1000).getTime() > decode(accessToken).exp * 1000)) {
forceLogout();
}
//wrap the default fetch function
const tokenFetch = async (url, options) => {
//use this?