remove "change password" in general account setting - rename "Forgot my password?" by "Reset your password" in login frame - #1918

This commit is contained in:
Laurent GAY
2025-12-30 15:49:38 +01:00
parent 6cbb3693bb
commit cf1918d2c2
14 changed files with 721 additions and 1076 deletions

View File

@@ -52,14 +52,6 @@ export const LOGGED_USER = gql`
${ACTOR_FRAGMENT}
`;
export const CHANGE_PASSWORD = gql`
mutation ChangePassword($oldPassword: String!, $newPassword: String!) {
changePassword(oldPassword: $oldPassword, newPassword: $newPassword) {
id
}
}
`;
export const CHANGE_EMAIL = gql`
mutation ChangeEmail($email: String!, $password: String!) {
changeEmail(email: $email, password: $password) {

View File

@@ -504,8 +504,6 @@
"Follows us, pending approval": "Follows us, pending approval",
"For instance: London": "For instance: London",
"For instance: London, Taekwondo, Architecture\u2026": "For instance: London, Taekwondo, Architecture\u2026",
"Forgot your password ?": "Forgot your password ?",
"Forgot your password?": "Forgot your password?",
"Framadate poll": "Framadate poll",
"From my groups": "From my groups",
"From the {startDate} at {startTime} to the {endDate} at {endTime}": "From the {startDate} at {startTime} to the {endDate} at {endTime}",
@@ -1060,6 +1058,7 @@
"Reset filters": "Reset filters",
"Reset my password": "Reset my password",
"Reset password": "Reset password",
"Reset your password": "Reset your password",
"Reset": "Reset",
"Resolved": "Resolved",
"Resource provided is not an URL": "Resource provided is not an URL",

View File

@@ -504,8 +504,6 @@
"Follows us, pending approval": "Nous suit, en attente de validation",
"For instance: London": "Par exemple : Lyon",
"For instance: London, Taekwondo, Architecture\u2026": "Par exemple : Lyon, Taekwondo, Architecture\u2026",
"Forgot your password ?": "Mot de passe oubli\u00e9 ?",
"Forgot your password?": "Mot de passe oubli\u00e9 ?",
"Framadate poll": "Sondage Framadate",
"From my groups": "De mes groupes",
"From the {startDate} at {startTime} to the {endDate} at {endTime}": "Du {startDate} \u00e0 {startTime} au {endDate} \u00e0 {endTime}",
@@ -1059,6 +1057,7 @@
"Reset filters": "R\u00e9initialiser les filtres",
"Reset my password": "R\u00e9initialiser mon mot de passe",
"Reset password": "R\u00e9initaliser le mot de passe",
"Reset your password": "Réinitialiser votre mot de passe",
"Reset": "Remettre \u00e0 z\u00e9ro",
"Resolved": "R\u00e9solu",
"Resource provided is not an URL": "La ressource fournie n'est pas une URL",

View File

@@ -80,64 +80,6 @@
{{ t("Change my email") }}
</o-button>
</form>
<h2 class="mt-2">{{ t("Password") }}</h2>
<o-notification
v-if="!canChangePassword && loggedUser.provider"
variant="warning"
:closable="false"
>
{{
t(
"You can't change your password because you are registered through {provider}.",
{
provider: providerName(loggedUser.provider),
}
)
}}
</o-notification>
<o-notification
variant="danger"
has-icon
aria-close-label="Close notification"
role="alert"
:key="error"
v-for="error in changePasswordErrors"
>{{ error }}</o-notification
>
<form
@submit.prevent="resetPasswordAction"
ref="passwordForm"
class="form"
v-if="canChangePassword"
>
<o-field :label="t('Old password')" label-for="account-old-password">
<o-input
aria-required="true"
required
type="password"
password-reveal
minlength="6"
id="account-old-password"
v-model="oldPassword"
expanded
/>
</o-field>
<o-field :label="t('New password')" label-for="account-new-password">
<o-input
aria-required="true"
required
type="password"
password-reveal
minlength="6"
id="account-new-password"
v-model="newPassword"
expanded
/>
</o-field>
<o-button class="mt-2" variant="primary" nativeType="submit">
{{ t("Change my password") }}
</o-button>
</form>
<h2 class="mt-2">{{ t("Delete account") }}</h2>
<p class="prose dark:prose-invert">
{{ t("Deleting my account will delete all of my identities.") }}
@@ -240,11 +182,7 @@ import { GraphQLError } from "graphql/error/GraphQLError";
import { computed, inject, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import {
CHANGE_EMAIL,
CHANGE_PASSWORD,
DELETE_ACCOUNT_AS_USER,
} from "../../graphql/user";
import { CHANGE_EMAIL, DELETE_ACCOUNT_AS_USER } from "../../graphql/user";
import RouteName from "../../router/name";
import { logout, SELECTED_PROVIDERS } from "../../utils/auth";
import { useOruga } from "@oruga-ui/oruga-next";
@@ -257,15 +195,11 @@ useHead({
title: computed(() => t("General settings")),
});
const passwordForm = ref<HTMLFormElement>();
const emailForm = ref<HTMLFormElement>();
const passwordForEmailChange = ref("");
const newEmail = ref("");
const changeEmailErrors = ref<string[]>([]);
const oldPassword = ref("");
const newPassword = ref("");
const changePasswordErrors = ref<string[]>([]);
const deletePasswordErrors = ref<string[]>([]);
const isDeleteAccountModalActive = ref(false);
const passwordForAccountDeletion = ref("");
@@ -289,7 +223,13 @@ changeEmailMutationDone(() => {
});
changeEmailMutationError((err) => {
handleErrors("email", err);
console.error(err);
if (err.graphQLErrors !== undefined) {
err.graphQLErrors.forEach(({ message }: { message: string }) => {
changeEmailErrors.value.push(message);
});
}
});
const resetEmailAction = async (): Promise<void> => {
@@ -303,33 +243,6 @@ const resetEmailAction = async (): Promise<void> => {
}
};
const {
mutate: changePasswordMutation,
onDone: onChangePasswordMutationDone,
onError: onChangePasswordMutationError,
} = useMutation(CHANGE_PASSWORD);
onChangePasswordMutationDone(() => {
oldPassword.value = "";
newPassword.value = "";
notifier?.success(t("The password was successfully changed"));
});
onChangePasswordMutationError((err) => {
handleErrors("password", err);
});
const resetPasswordAction = async (): Promise<void> => {
if (passwordForm.value?.reportValidity()) {
changePasswordErrors.value = [];
changePasswordMutation({
oldPassword: oldPassword.value,
newPassword: newPassword.value,
});
}
};
const openDeleteAccountModal = (): void => {
passwordForAccountDeletion.value = "";
isDeleteAccountModalActive.value = true;
@@ -376,10 +289,6 @@ const deleteAccount = () => {
});
};
const canChangePassword = computed((): boolean => {
return !loggedUser.value?.provider;
});
const canChangeEmail = computed((): boolean => {
return !loggedUser.value?.provider;
});
@@ -401,22 +310,4 @@ const hasUserGotAPassword = computed((): boolean => {
const deleteAccountPasswordFieldType = computed((): string | null => {
return deletePasswordErrors.value.length > 0 ? "is-danger" : null;
});
const handleErrors = (type: string, err: any) => {
console.error(err);
if (err.graphQLErrors !== undefined) {
err.graphQLErrors.forEach(({ message }: { message: string }) => {
switch (type) {
case "password":
changePasswordErrors.value.push(message);
break;
case "email":
default:
changeEmailErrors.value.push(message);
break;
}
});
}
};
</script>

View File

@@ -91,7 +91,7 @@
name: RouteName.SEND_PASSWORD_RESET,
params: { email: credentials.email },
}"
>{{ t("Forgot your password?") }}</o-button
>{{ t("Reset your password") }}</o-button
>
<o-button
tag="router-link"

View File

@@ -1,7 +1,7 @@
<template>
<section class="container mx-auto">
<h1>
{{ t("Forgot your password?") }}
{{ t("Reset your password") }}
</h1>
<p>
{{