From 0d6d8db6dd6f25cbcccd42bef089a1cb7658a803 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 8 Feb 2014 16:14:41 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20v=C3=A9rification=20des=20mot?= =?UTF-8?q?s=20de=20passe=20=C3=A0=20l'inscription.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/lib/DNSManager.pm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/www/lib/DNSManager.pm b/www/lib/DNSManager.pm index b324f7e..f9168d9 100755 --- a/www/lib/DNSManager.pm +++ b/www/lib/DNSManager.pm @@ -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'; }