mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-17 22:29:52 +08:00
enforcing strong passwords when changing password
This commit is contained in:
parent
b26348fcce
commit
8bf5d451bd
1 changed files with 12 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
unlink,
|
||||
updatePassword,
|
||||
} from "firebase/auth";
|
||||
import { isPasswordStrong } from "../utils/misc";
|
||||
|
||||
interface Input {
|
||||
placeholder?: string;
|
||||
|
|
@ -524,6 +525,17 @@ list["updatePassword"] = new SimplePopup(
|
|||
Notifications.add("New passwords don't match", 0);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
window.location.hostname !== "localhost" &&
|
||||
!isPasswordStrong(newPass)
|
||||
) {
|
||||
Notifications.add(
|
||||
"New password must contain at least one capital letter, number, a special character and at least 8 characters long",
|
||||
0,
|
||||
4
|
||||
);
|
||||
return;
|
||||
}
|
||||
Loader.show();
|
||||
await reauthenticateWithCredential(user, credential);
|
||||
await updatePassword(user, newPass);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue