se va face prin intermediul paginii password_reset.php
se va determina daca metoda este POST sau GET
daca este POST
se va determina daca utilizatorul este autentificat sau nu folosind informatiile din $_SESSION si se va continua cu
daca este GET:
se verifica daca parametrul token este setat si daca este valid dup care se continua pe ramura "Cand utilizatorul nu este autentificat"
Cand utilizatorul este autentificat:
se va afisa un formular cu 3 campuri:
parola curenta
parola noua
confirma parola
cand se face post la formular
se valideaza:
parola curenta coincide cu parola din baza de date
parola noua si confirma parola au aceeasi valoare
daca forma e valida:
se face update in baza de data a parolei pentru utilizatorul curent
daca forma e invalida:
se re-afiseaza forma impreuna cu erorile de validare
Cand utilizatorul NU este autentificat:
se afiseaza un formular care va cere utilizatorului sa introduca o adresa de e-mail valida
cand se face post la formular:
se valideaza:
campul email are o valoare setata
valoarea din campul e-mail este valida
valoarea din campul e-mail se regaseste in baza de date
daca formularul nu este valid: se vor afisa erorile generate
daca formularul este valid:
se genereaza un token
se introduce token-ul in tabla pentru utilizator
se genereaza un link care contine token-ul
(in prod) se trimite e-mail catre utilizator cu token-ul folosit pentru resetarea parolei
(in test) se redirecteaza utilizatorul catre link-ul de recuperare a parolei
Recuperarea Parolei
se realizeaza prin password_recover.php
se realizeaza doar daca utilizatorul nu este autentificat (in caz contrar este redirectat catre password_reset.php) si exista in variabila $_GET valori pentru user_id si token
daca se indeplinesc toate conditiile de mai sus, se afiseaza un formular care permite utilizatorului sa introduca parola noua si sa o confirme
la postarea formei se valideaza:
valorile din campurile de parole sunt egale, in caz contrar se afiseaza mesaj de eroare
daca forma postata nu are erori se afiseaza un mesaj de confirmare si se ofera posibilitate de a merge la pagina de login
Resetarea parolei
Cand utilizatorul este autentificat:
Cand utilizatorul NU este autentificat:
Recuperarea Parolei