Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing password strength check #1071

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions src/api/util/utility/passwordStrength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ export function checkPassword(password: string): number {
let pwStrength = 0;

// checks for total password len
if (password.length >= 8 - 1) {
if (password.length >= 7) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these might been hard coded values for min and max that should have been configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I add the configuration options back then?

Copy link
Contributor

Choose a reason for hiding this comment

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

should I add the configuration options back then?

So far, we've tried to make as much as possible configurable my the instance owner, and I think the password policy would be no exception. But probably wait for other opinions on it.

pwStrength += 0.05;
}

// checks for amount of Numbers
const numbers = password.match(reNUMBER);
if (numbers && numbers.length >= 2 - 1) {
if (numbers && numbers.length >= 1) {
pwStrength += 0.05;
}

// checks for amount of Uppercase Letters
const uppercase = password.match(reUPPER);
if (uppercase && uppercase.length >= 2 - 1) {
if (uppercase && uppercase.length >= 1) {
pwStrength += 0.05;
}

// checks for amount of symbols
const symbols = password.match(reSYMBOLS);
if (symbols && symbols.length >= 2 - 1) {
if (symbols && symbols.length >= 1) {
pwStrength += 0.05;
}

Expand Down