After adding view icon for passwords

This commit is contained in:
Your Name 2026-11-02 19:24:28 +02:00
parent ad66af8e01
commit 55ddbb1c09
5 changed files with 84 additions and 5 deletions

View File

@ -1,7 +1,7 @@
name: prediqo_mobile name: prediqo_mobile
description: "Tloto mobile app - prediction games and crypto wallet." description: "Tloto mobile app - prediction games and crypto wallet."
publish_to: 'none' publish_to: 'none'
version: 2.0.2+9 version: 2.0.2+10
environment: environment:
sdk: ^3.9.2 sdk: ^3.9.2

View File

@ -3,7 +3,21 @@
* Authenticates via `/api/v1/auth/login`, stores tokens in auth context, * Authenticates via `/api/v1/auth/login`, stores tokens in auth context,
* and redirects to the route the user attempted before sign-in. * and redirects to the route the user attempted before sign-in.
*/ */
import { Alert, Box, Button, Card, CardContent, Link, Stack, TextField, Typography } from '@mui/material'; import {
Alert,
Box,
Button,
Card,
CardContent,
IconButton,
InputAdornment,
Link,
Stack,
TextField,
Typography,
} from '@mui/material';
import VisibilityOffRoundedIcon from '@mui/icons-material/VisibilityOffRounded';
import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded';
import { useState, useCallback } from 'react'; import { useState, useCallback } from 'react';
import { Navigate, useLocation, useNavigate, Link as RouterLink } from 'react-router-dom'; import { Navigate, useLocation, useNavigate, Link as RouterLink } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
@ -52,6 +66,7 @@ export function LoginPage() {
const [email, setEmail] = useState(''); const [email, setEmail] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [totpCode, setTotpCode] = useState(''); const [totpCode, setTotpCode] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
@ -259,9 +274,25 @@ export function LoginPage() {
label={t('common.password')} label={t('common.password')}
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
type="password" type={showPassword ? 'text' : 'password'}
autoComplete="current-password" autoComplete="current-password"
fullWidth fullWidth
slotProps={{
input: {
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label={showPassword ? t('common.hidePassword') : t('common.showPassword')}
onClick={() => setShowPassword((v) => !v)}
edge="end"
size="small"
>
{showPassword ? <VisibilityOffRoundedIcon /> : <VisibilityRoundedIcon />}
</IconButton>
</InputAdornment>
),
},
}}
/> />
<TextField <TextField
label={t('auth.totpOptional')} label={t('auth.totpOptional')}

View File

@ -7,11 +7,15 @@ import {
Button, Button,
Card, Card,
CardContent, CardContent,
IconButton,
InputAdornment,
Link, Link,
Stack, Stack,
TextField, TextField,
Typography, Typography,
} from '@mui/material'; } from '@mui/material';
import VisibilityOffRoundedIcon from '@mui/icons-material/VisibilityOffRounded';
import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Link as RouterLink, Navigate, useNavigate, useSearchParams } from 'react-router-dom'; import { Link as RouterLink, Navigate, useNavigate, useSearchParams } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
@ -44,6 +48,8 @@ export function RegisterPage() {
const [phone, setPhone] = useState(''); const [phone, setPhone] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [confirmPassword, setConfirmPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const [country, setCountry] = useState(''); const [country, setCountry] = useState('');
const [nationality, setNationality] = useState(''); const [nationality, setNationality] = useState('');
const [gender, setGender] = useState<UserGender | ''>(''); const [gender, setGender] = useState<UserGender | ''>('');
@ -231,15 +237,31 @@ export function RegisterPage() {
/> />
<TextField <TextField
label={t('auth.passwordRequired')} label={t('auth.passwordRequired')}
type="password" type={showPassword ? 'text' : 'password'}
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
fullWidth fullWidth
autoComplete="new-password" autoComplete="new-password"
slotProps={{
input: {
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label={showPassword ? t('common.hidePassword') : t('common.showPassword')}
onClick={() => setShowPassword((v) => !v)}
edge="end"
size="small"
>
{showPassword ? <VisibilityOffRoundedIcon /> : <VisibilityRoundedIcon />}
</IconButton>
</InputAdornment>
),
},
}}
/> />
<TextField <TextField
label={t('auth.confirmPasswordRequired')} label={t('auth.confirmPasswordRequired')}
type="password" type={showConfirmPassword ? 'text' : 'password'}
value={confirmPassword} value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)} onChange={(e) => setConfirmPassword(e.target.value)}
fullWidth fullWidth
@ -250,6 +272,28 @@ export function RegisterPage() {
? t('auth.passwordsMustMatch') ? t('auth.passwordsMustMatch')
: undefined : undefined
} }
slotProps={{
input: {
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label={
showConfirmPassword ? t('common.hidePassword') : t('common.showPassword')
}
onClick={() => setShowConfirmPassword((v) => !v)}
edge="end"
size="small"
>
{showConfirmPassword ? (
<VisibilityOffRoundedIcon />
) : (
<VisibilityRoundedIcon />
)}
</IconButton>
</InputAdornment>
),
},
}}
/> />
<CountryAutocomplete <CountryAutocomplete

View File

@ -18,6 +18,8 @@ export const en = {
edit: 'Edit', edit: 'Edit',
email: 'Email', email: 'Email',
password: 'Password', password: 'Password',
showPassword: 'Show password',
hidePassword: 'Hide password',
sending: 'Sending…', sending: 'Sending…',
save: 'Save', save: 'Save',
cancel: 'Cancel', cancel: 'Cancel',

View File

@ -18,6 +18,8 @@ export const fr = {
edit: 'Modifier', edit: 'Modifier',
email: 'E-mail', email: 'E-mail',
password: 'Mot de passe', password: 'Mot de passe',
showPassword: 'Afficher le mot de passe',
hidePassword: 'Masquer le mot de passe',
sending: 'Envoi…', sending: 'Envoi…',
save: 'Enregistrer', save: 'Enregistrer',
cancel: 'Annuler', cancel: 'Annuler',