Skip to content
Snippets Groups Projects
Unverified Commit 9febec87 authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

validate common passwords (#23287)

parent 217c52ad
No related branches found
No related tags found
No related merge requests found
......@@ -5,15 +5,13 @@ import { createThunkAction } from "metabase/lib/redux";
export const UPDATE_PASSWORD = "UPDATE_PASSWORD";
export const VALIDATE_PASSWORD = "VALIDATE_PASSWORD";
export const validatePassword = createThunkAction(VALIDATE_PASSWORD, function(
password,
) {
return async function() {
return await UtilApi.password_check({
password: password,
});
};
});
export const validatePassword = createThunkAction(
VALIDATE_PASSWORD,
password => async () =>
UtilApi.password_check({
password,
}),
);
export const updatePassword = createThunkAction(UPDATE_PASSWORD, function(
user_id,
......
......@@ -13,7 +13,8 @@ const UserPasswordForm = ({ user, validatePassword, updatePassword }) => {
const handleAsyncValidate = useCallback(
async ({ password }) => {
try {
validatePassword(password);
await validatePassword(password);
return {};
} catch (error) {
return error.data.errors;
......
......@@ -93,6 +93,20 @@ describe("user > settings", () => {
cy.findByText("Sign in to Metabase");
});
it("should validate common passwords (metabase#23259)", () => {
cy.visit("/account/password");
cy.findByLabelText("Create a password")
.as("passwordInput")
.type("qwerty123")
.blur();
cy.contains("password is too common");
cy.get("@passwordInput").clear();
cy.contains("password is too common").should("not.exist");
});
it("should be able to change a language (metabase#22192)", () => {
cy.intercept("PUT", "/api/user/*").as("updateUserSettings");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment