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 %>
+ +
+ + + + + +
+ +