feat: fixes
This commit is contained in:
@@ -7,7 +7,7 @@ export function checkIfEmailIsValid({ email }) {
|
|||||||
|
|
||||||
export function checkIfPasswordIsStrongEnough({ password }) {
|
export function checkIfPasswordIsStrongEnough({ password }) {
|
||||||
const reg =
|
const reg =
|
||||||
/^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})/;
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{6,})/;
|
||||||
return reg.test(password);
|
return reg.test(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ export function handleFirebaseError(code = "") {
|
|||||||
case "auth/too-many-requests":
|
case "auth/too-many-requests":
|
||||||
return "Trop de tentatives. Réessaie dans quelques minutes.";
|
return "Trop de tentatives. Réessaie dans quelques minutes.";
|
||||||
case "auth/email-already-in-use":
|
case "auth/email-already-in-use":
|
||||||
return "Il existe déjà un compte avec cette adresse e-mail.";
|
return "Un compte avec cette adresse mail existe déjà.";
|
||||||
case "auth/missing-password":
|
case "auth/missing-password":
|
||||||
return "Renseigne ton mot de passe.";
|
return "Renseigne ton mot de passe.";
|
||||||
case "auth/weak-password":
|
case "auth/weak-password":
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import { background } from "../assets";
|
|||||||
import GradientButton from "../components/GradientButton";
|
import GradientButton from "../components/GradientButton";
|
||||||
import { Input } from "../components/Input";
|
import { Input } from "../components/Input";
|
||||||
import ItemContainer from "../components/ItemContainer/ItemContainer";
|
import ItemContainer from "../components/ItemContainer/ItemContainer";
|
||||||
import { handleFirebaseError } from "../actions/signupActions";
|
import {
|
||||||
|
checkIfPasswordIsStrongEnough,
|
||||||
|
handleFirebaseError,
|
||||||
|
} from "../actions/signupActions";
|
||||||
import firebase, { usersRef } from "../config/firebase";
|
import firebase, { usersRef } from "../config/firebase";
|
||||||
import Page from "../layouts/Page";
|
import Page from "../layouts/Page";
|
||||||
import { isWeb } from "../hooks/useLayoutType";
|
import { isWeb } from "../hooks/useLayoutType";
|
||||||
@@ -28,7 +31,7 @@ const CreatePassword = () => {
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [, setTooltip] = useGlobal("_tooltip");
|
const [, setTooltip] = useGlobal("_tooltip");
|
||||||
|
|
||||||
const passwordRegex = useMemo(() => /^.{6,}$/, []);
|
|
||||||
|
|
||||||
const handlePasswordChange = (text) => {
|
const handlePasswordChange = (text) => {
|
||||||
setPassword(text);
|
setPassword(text);
|
||||||
@@ -37,20 +40,22 @@ const CreatePassword = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!passwordRegex.test(text)) {
|
if (!checkIfPasswordIsStrongEnough({ password: text })) {
|
||||||
setPasswordError("Ton mot de passe doit contenir au moins 6 caractères.");
|
setPasswordError(
|
||||||
|
"Le mot de passe doit contenir au moins une majuscule, une minuscule, un chiffre et avoir une longueur minimale de 6 caractères",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
setPasswordError("");
|
setPasswordError("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const isPasswordValid = passwordRegex.test(password);
|
const isPasswordValid = checkIfPasswordIsStrongEnough({ password });
|
||||||
|
|
||||||
const onCreateAccount = async () => {
|
const onCreateAccount = async () => {
|
||||||
try {
|
try {
|
||||||
if (!isPasswordValid) {
|
if (!isPasswordValid) {
|
||||||
setTooltip({
|
setTooltip({
|
||||||
text: "Ton mot de passe doit contenir au moins 6 caractères.",
|
text: "Le mot de passe doit contenir au moins une majuscule, une minuscule, un chiffre et avoir une longueur minimale de 6 caractères",
|
||||||
type: "error",
|
type: "error",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import ProgressSlider from "../../components/player/ProgressSlider";
|
|||||||
import { isWeb } from "../../hooks/useLayoutType";
|
import { isWeb } from "../../hooks/useLayoutType";
|
||||||
import Page from "../../layouts/Page";
|
import Page from "../../layouts/Page";
|
||||||
import { Routes } from "../../navigation";
|
import { Routes } from "../../navigation";
|
||||||
import { navigate } from "../../navigation/NavigationService";
|
import { navigate, reset } from "../../navigation/NavigationService";
|
||||||
import { useUser } from "../../providers/UserDataProvider";
|
import { useUser } from "../../providers/UserDataProvider";
|
||||||
import { Palette, Style } from "../../styles";
|
import { Palette, Style } from "../../styles";
|
||||||
import { gutters, size } from "../../styles/Style";
|
import { gutters, size } from "../../styles/Style";
|
||||||
@@ -138,7 +138,10 @@ const SongReady = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await pauseAllPlayers();
|
await pauseAllPlayers();
|
||||||
navigate(Routes.ChooseCoverType);
|
reset({
|
||||||
|
index: 1,
|
||||||
|
routes: [{ name: Routes.BottomTab }, { name: Routes.ChooseCoverType }],
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Validate error", e?.message);
|
console.log("Validate error", e?.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,12 @@ const ValidateCover = () => {
|
|||||||
|
|
||||||
const handleSelectOption = useCallback(
|
const handleSelectOption = useCallback(
|
||||||
async (option) => {
|
async (option) => {
|
||||||
if (!option || option?.id === selectedOptionId || isSelecting) {
|
if (
|
||||||
|
!option ||
|
||||||
|
option?.id === selectedOptionId ||
|
||||||
|
isSelecting ||
|
||||||
|
selectedOptionId // Prevent re-selection
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const existingCover = selectedProject?.cover || {};
|
const existingCover = selectedProject?.cover || {};
|
||||||
|
|||||||
@@ -352,6 +352,16 @@ export const sanitizeStructureList = (structure = [], options = {}) => {
|
|||||||
result.unshift(intro);
|
result.unshift(intro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const outroIndex = result.findIndex((item) => {
|
||||||
|
const meta = getSegmentMeta(item);
|
||||||
|
return meta?.exclusiveGroup === "outro";
|
||||||
|
});
|
||||||
|
|
||||||
|
if (outroIndex !== -1 && outroIndex < result.length - 1) {
|
||||||
|
const [outro] = result.splice(outroIndex, 1);
|
||||||
|
result.push(outro);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user