From f7661b144935fb819c366971a33d96cf69449932 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 22 Jan 2014 23:04:54 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20de=20la=20possibilit=C3=A9=20de=20s'ins?= =?UTF-8?q?crire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/lib/DNSManager.pm | 44 +++++++++++++++++++++++++++++++++++++++--- www/views/index.tt | 2 ++ www/views/subscribe.tt | 29 ++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 www/views/subscribe.tt diff --git a/www/lib/DNSManager.pm b/www/lib/DNSManager.pm index a3c3c23..b834613 100644 --- a/www/lib/DNSManager.pm +++ b/www/lib/DNSManager.pm @@ -82,9 +82,9 @@ get '/home' => sub { my $cf = session('creationFailure'); my $dn = session('domainName'); - session 'creationSuccess' => ''; - session 'creationFailure' => ''; - session 'domainName' => ''; + session creationSuccess => ''; + session creationFailure => ''; + session domainName => ''; template home => { login => session('login') @@ -245,6 +245,44 @@ prefix '/user' => sub { redirect '/'; }; + post '/add/' => sub { + + if ( param('login') && param('password') ) + { + + my $app = initco(); + $app->register_user(param('login'), param('password')); + session login => param('login'); + session password => param('password'); + redirect '/home'; + + } + else { + session errmsg => q/login ou password non renseignés/; + redirect '/user/subscribe'; + } + + }; + + get '/subscribe' => sub { + + if( defined session('login') ) + { + redirect '/home'; + } + else { + + my $errmsg = session 'errmsg' ; + session errmsg => ''; + + template subscribe => { + errmsg => $errmsg + }; + } + + + }; + get '/del/:user' => sub { my $app = initco(); diff --git a/www/views/index.tt b/www/views/index.tt index fc6eaba..ab1723b 100644 --- a/www/views/index.tt +++ b/www/views/index.tt @@ -57,4 +57,6 @@

En résumé : cherchez votre nom de domaine, réservez-le, on s'occupe du reste !

+

S'enregistrer

+ diff --git a/www/views/subscribe.tt b/www/views/subscribe.tt new file mode 100644 index 0000000..404b5fa --- /dev/null +++ b/www/views/subscribe.tt @@ -0,0 +1,29 @@ + + +
+ +<% errmsg %>
+ +
+ + + + + +
+ +