Compare commits

...

2 Commits

Author SHA1 Message Date
DebaucheryLibrarian e7107c33c2 0.9.5 2024-03-17 05:51:22 +01:00
DebaucheryLibrarian 6f27e0a7dd Fixed invalid credential handling. 2024-03-17 05:51:18 +01:00
4 changed files with 9 additions and 13 deletions

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{
"name": "traxxx-web",
"version": "0.9.4",
"version": "0.9.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.9.4",
"version": "0.9.5",
"dependencies": {
"@brillout/json-serializer": "^0.5.8",
"@dicebear/collection": "^7.0.5",

View File

@ -70,5 +70,5 @@
"postcss-custom-media": "^10.0.2",
"postcss-nesting": "^12.0.2"
},
"version": "0.9.4"
"version": "0.9.5"
}

View File

@ -47,11 +47,9 @@ export async function login(credentials, userIp) {
const { user, stashes } = await fetchUser(credentials.username.trim(), {
email: true,
raw: true,
});
if (!user) {
}).catch(() => {
throw new HttpError('Username or password incorrect', 401);
}
});
await verifyPassword(credentials.password, user.password);
@ -59,8 +57,6 @@ export async function login(credentials, userIp) {
.update('last_login', 'NOW()')
.where('id', user.id);
console.log('login user', user);
logger.verbose(`Login from '${user.username}' (${user.id}, ${userIp})`);
try {

View File

@ -46,14 +46,14 @@ export async function fetchUser(userId, options = {}) {
.groupBy('users.id', 'users_roles.role')
.first();
if (!user) {
throw new HttpError(`User '${userId}' not found`, 404);
}
const stashes = await knex('stashes')
.where('user_id', user.id)
.leftJoin('stashes_meta', 'stashes_meta.stash_id', 'stashes.id');
if (!user) {
throw HttpError(`User '${userId}' not found`, 404);
}
if (options.raw) {
return { user, stashes };
}