Skip to content

Password resetation#161

Merged
Jusu05 merged 13 commits into
developfrom
password-reset
Mar 31, 2026
Merged

Password resetation#161
Jusu05 merged 13 commits into
developfrom
password-reset

Conversation

@Jusu05

@Jusu05 Jusu05 commented Mar 22, 2026

Copy link
Copy Markdown
Contributor
  • Added temporary pasword resetation to backend
  • Seperated roles out of database

@ArktinenKarpalo ArktinenKarpalo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests for password reset are lacking. It's questionable whether authenticateUser works correctly for temporary passwords?

Comment thread src/db/userStore.ts Outdated

export const createTempPassword = async (userId, userName) => {
const now = new Date();
const hash = bcrypt.hashSync(`${userName}${now.getMilliseconds()}${userId}`, 11);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why temp password is not generated with crypto.RandomBytes instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No good reason that function looks to do same thing but better

@ArktinenKarpalo

Copy link
Copy Markdown
Contributor

Why are roles separated out of the database? Now by looking at the database its difficult to say what it means for user to have role 2 or 7, or which roles are even available. I think they should be kept in the ROLES table.

@ArktinenKarpalo

Copy link
Copy Markdown
Contributor

If you remove v1 auth endpoint you should check that existing services like rv.tko-aly.fi still work, or alternatively we could have for the time being both v1 and v2 auth endpoints.

@Jusu05

Jusu05 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

Why are roles separated out of the database? Now by looking at the database its difficult to say what it means for user to have role 2 or 7, or which roles are even available. I think they should be kept in the ROLES table.

It's Eesier edit them from the backend code and it's simular than the action ids

@ArktinenKarpalo

Copy link
Copy Markdown
Contributor

Why are roles separated out of the database? Now by looking at the database its difficult to say what it means for user to have role 2 or 7, or which roles are even available. I think they should be kept in the ROLES table.

It's Eesier edit them from the backend code and it's simular than the action ids

But there is ACTION table for the action IDs as well, which can be edited from backend code as well via migrations.

@Jusu05
Jusu05 merged commit 5a30db1 into develop Mar 31, 2026
0 of 2 checks passed
@Jusu05
Jusu05 deleted the password-reset branch March 31, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants