fix: 🐛 Hide password update modal #690
Tim Izzo tim@5ika.ch
Thu, 25 Sep 2025 16:03:08 +0200
7 files changed,
0 insertions(+),
144 deletions(-)
D
frontend/containers/Profile/EditPassword.tsx
@@ -1,84 +0,0 @@
-import React from 'react'; -import {styled} from '@mui/material/styles'; -import Card from '@mui/material/Card'; -import CardContent from '@mui/material/CardContent'; -import CardActions from '@mui/material/CardActions'; -import Button from '@mui/material/Button'; -import {useTranslation} from 'next-i18next'; -import TextField from '@mui/material/TextField'; - -const PREFIX = 'EditPassword'; - -const classes = { - actions: `${PREFIX}-actions`, -}; - -const Root = styled('form')(({theme}) => ({ - [`& .${classes.actions}`]: { - justifyContent: 'flex-end', - }, -})); - -const EditPassword = ({ - oldPassword, - setOldPassword, - newPassword, - setNewPassword, - error, - save, - cancel, -}) => { - const {t} = useTranslation(); - - return ( - <Root - onSubmit={evt => { - evt?.preventDefault?.(); - save(); - }} - > - <Card> - <CardContent> - <TextField - label={t('profile.current_password')} - type="password" - fullWidth - autoFocus - margin="dense" - value={oldPassword} - onChange={({target: {value = ''}}) => setOldPassword(value)} - id="ProfileCurrentPassword" - name="current_password" - error={!!error} - helperText={error} - /> - <TextField - type="password" - label={t('profile.new_password')} - fullWidth - margin="dense" - value={newPassword} - onChange={({target: {value = ''}}) => setNewPassword(value)} - id="ProfileNewPassword" - name="new_password" - /> - </CardContent> - <CardActions className={classes.actions}> - <Button type="button" onClick={cancel}> - {t('profile.actions.cancel')} - </Button> - <Button - type="submit" - color="primary" - variant="contained" - disabled={oldPassword.length < 4 || newPassword.length < 4} - > - {t('profile.actions.save_new_password')} - </Button> - </CardActions> - </Card> - </Root> - ); -}; - -export default EditPassword;
M
frontend/containers/Profile/index.tsx
→
frontend/containers/Profile/index.tsx
@@ -5,9 +5,7 @@ import CardContent from '@mui/material/CardContent';
import CardActions from '@mui/material/CardActions'; import Button from '@mui/material/Button'; import {useTranslation} from 'next-i18next'; -import EditPassword from './EditPassword'; import ProfileField from './ProfileField'; -import useToastStore from '../../stores/useToastStore'; import { UsersPermissionsUser, useUpdateMeMutation,@@ -24,11 +22,9 @@ }
const Profile = ({profile, logout}: Props) => { const {t} = useTranslation(); - const addToast = useToastStore(s => s.addToast); const [updateProfile] = useUpdateMeMutation(); const [isEditing, setIsEditing] = useState(false); - const [isEditingPassword, setIsEditingPassword] = useState(false); const [firstName, setFirstName] = useState(profile.firstName); const [lastName, setLastName] = useState(profile.lastName); const [email, setEmail] = useState(profile.email);@@ -41,35 +37,8 @@ i => !i,
profile.notificationEnabled ); - const [oldPassword, setOldPassword] = useState(''); - const [newPassword, setNewPassword] = useState(''); - const [errorPassword, setErrorPassword] = useState(''); const isStrapiUser = profile.provider === 'local'; - const resetPassword = () => { - setIsEditingPassword(false); - setNewPassword(''); - setOldPassword(''); - setErrorPassword(''); - }; - - const savePassword = async () => { - try { - await updateProfile({ - variables: { - userUpdate: {oldPassword, password: newPassword}, - }, - }); - addToast(t('profile.password_changed')); - resetPassword(); - } catch (err) { - if (err.message === 'Wrong password') { - setErrorPassword(t('profile.errors.password_nomatch')); - return; - } - } - }; - const onSave = async () => { try { await updateProfile({@@ -88,19 +57,6 @@ } catch (error) {
console.error(error); } }; - - if (isEditingPassword) - return ( - <EditPassword - oldPassword={oldPassword} - newPassword={newPassword} - setOldPassword={setOldPassword} - setNewPassword={setNewPassword} - error={errorPassword} - save={savePassword} - cancel={resetPassword} - /> - ); return ( <Container@@ -176,17 +132,6 @@ >
{t('profile.actions.edit')} </Button> </> - )} - {isEditing && isStrapiUser && ( - <Button - type="button" - onClick={evt => { - if (evt.preventDefault) evt.preventDefault(); - setIsEditingPassword(true); - }} - > - {t('profile.actions.change_password')} - </Button> )} {isEditing && ( <Button
M
frontend/locales/de.json
→
frontend/locales/de.json
@@ -136,7 +136,6 @@ "placeInput.mapboxUnavailable": "Zurzeit können wir keine Orte vorschlagen",
"placeInput.noCoordinates": "Dieser Ort ist nicht geografisch zugeordnet und wird nicht auf der Karte angezeigt", "placeInput.item.noCoordinates": "Keine Koordinaten", "profile.actions.cancel": "Abbrechen", - "profile.actions.change_password": "Passwort ändern", "profile.actions.edit": "Bearbeiten", "profile.actions.logout": "Abmeldung", "profile.actions.save_new_password": "Aktualisieren",
M
frontend/locales/en.json
→
frontend/locales/en.json
@@ -176,7 +176,6 @@ "placeInput.mapboxUnavailable": "We are not able to suggest geolocated places at the moment",
"placeInput.noCoordinates": "This place is not geo-located and won't appear on the map", "placeInput.item.noCoordinates": "No coordinates", "profile.actions.cancel": "Cancel", - "profile.actions.change_password": "Change your password", "profile.actions.edit": "Edit", "profile.actions.logout": "Logout", "profile.actions.save": "Save",
M
frontend/locales/fr.json
→
frontend/locales/fr.json
@@ -171,7 +171,6 @@ "placeInput.mapboxUnavailable": "Nous ne pouvons pas suggérer de lieux géolocalisés pour le moment",
"placeInput.noCoordinates": "Le lieu indiqué n'a pas pu être géo-localisé et ne sera pas affiché sur la carte. Essayez une adresse plus précise.", "placeInput.item.noCoordinates": "Pas de coordonnées", "profile.actions.cancel": "Annuler", - "profile.actions.change_password": "Changer son mot de passe", "profile.actions.edit": "Editer", "profile.actions.logout": "Se déconnecter", "profile.actions.save": "Enregistrer",
M
frontend/locales/it.json
→
frontend/locales/it.json
@@ -205,7 +205,6 @@ "passenger.title": "Lista d'attesa",
"placeInput.noCoordinates": "Questa posizione non è geolocalizzata e non comparirà sulla mappa", "placeInput.item.noCoordinates": "Nessuna coordinata", "profile.actions.cancel": "Annulla", - "profile.actions.change_password": "Cambia la tua password", "profile.actions.edit": "Modifica", "profile.actions.logout": "Esci", "profile.actions.save": "Salva",
M
frontend/locales/nl.json
→
frontend/locales/nl.json
@@ -157,7 +157,6 @@ "placeInput.mapboxUnavailable": "Er kunnen momenteel geen locaties worden voorgesteld",
"placeInput.noCoordinates": "Deze locatie is niet aangetroffen en verschijnt daarom niet op de kaart", "placeInput.item.noCoordinates": "Geen coördinaten", "profile.actions.cancel": "Annuleren", - "profile.actions.change_password": "Wachtwoord wijzigen", "profile.actions.edit": "Bewerken", "profile.actions.logout": "Uitloggen", "profile.actions.save": "Opslaan",