Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0

Ajout de la vérification des mots de passe à l'inscription.

master
Philippe Pittoli 2014-02-08 16:14:41 +01:00
parent 6d75a31f88
commit 0d6d8db6dd
1 changed files with 18 additions and 15 deletions

View File

@ -520,27 +520,30 @@ prefix '/user' => sub {
# add a user => registration
post '/add/' => sub {
if ( param('login') && param('password') ) {
unless ( param('login') && param('password') && param('password2') ) {
session errmsg => q/Identifiant ou mot de passe non renseigné./;
redirect '/user/subscribe';
return;
}
my $pass = sha256_hex(param('password'));
unless ( param('password') eq param('password2')) {
session errmsg => q/Les mots de passes ne sont pas identiques./;
redirect '/user/subscribe';
return;
}
my $app = initco();
my ($success) = $app->register_user(param('login')
, $pass);
my $pass = sha256_hex(param('password'));
if($success) {
session login => param('login');
session password => $pass;
redirect '/user/home';
}
else {
session errmsg => q/Ce pseudo est déjà pris./;
redirect '/user/subscribe';
}
my $app = initco();
my ($success) = $app->register_user(param('login'), $pass);
if($success) {
session login => param('login');
session password => $pass;
redirect '/user/home';
}
else {
session errmsg => q/login ou password non renseignés/;
session errmsg => q/Ce pseudo est déjà pris./;
redirect '/user/subscribe';
}