summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/JWebmail.pm4
-rw-r--r--lib/JWebmail/Controller/Webmail.pm8
-rw-r--r--templates/not_found_.html.ep4
-rw-r--r--templates/webmail/about.html.ep2
-rw-r--r--templates/webmail/login.html.ep (renamed from templates/webmail/noaction.html.ep)2
5 files changed, 11 insertions, 9 deletions
diff --git a/lib/JWebmail.pm b/lib/JWebmail.pm
index 9899b05..98001a1 100644
--- a/lib/JWebmail.pm
+++ b/lib/JWebmail.pm
@@ -83,9 +83,9 @@ sub route {
my $r = shift || $self->routes;
- $r->get('/' => 'noaction')->to('Webmail#noaction');
+ $r->get('/' => 'login')->to('Webmail#noaction');
+ $r->post('/' => 'login')->to('Webmail#login');
$r->get('/about')->to('Webmail#about');
- $r->post('/login')->to('Webmail#login');
$r->get('/logout')->to('Webmail#logout');
my $a = $r->under('/')->to('Webmail#auth');
diff --git a/lib/JWebmail/Controller/Webmail.pm b/lib/JWebmail/Controller/Webmail.pm
index d01abae..ee4a532 100644
--- a/lib/JWebmail/Controller/Webmail.pm
+++ b/lib/JWebmail/Controller/Webmail.pm
@@ -20,7 +20,9 @@ sub noaction {
if ($user) {
$self->res->code(307);
$self->redirect_to('home');
+ return;
}
+ $self->render(action => 'login');
}
@@ -71,7 +73,8 @@ sub login {
my $passwd = $v->required('password')->size(4, 50)->like(qr/^.+$/)->param; # no new-lines
if ($v->has_error) {
- return $self->render(action => 'noaction', status => 400);
+ $self->render(status => 400);
+ return;
}
my $auth = $self->users->Auth(user => $user, password => $passwd);
@@ -87,7 +90,6 @@ sub login {
else {
$self->render(
status => 401,
- action => 'noaction',
warning => $self->l('login') . ' ' . $self->l('failed') . '!',
);
}
@@ -103,7 +105,7 @@ sub logout {
# $self->session(expires => 1);
$self->res->code(303);
- $self->redirect_to('noaction');
+ $self->redirect_to('login');
}
diff --git a/templates/not_found_.html.ep b/templates/not_found_.html.ep
index d1b353f..b96e46e 100644
--- a/templates/not_found_.html.ep
+++ b/templates/not_found_.html.ep
@@ -9,8 +9,8 @@
Not the page you are looking for.
</p>
<p class=center>
- Go back or go to the <a href="<%= url_for 'noaction' %>">start page</a>.
+ Go back or go to the <%= link_to 'start page' => 'login' %>.
</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/templates/webmail/about.html.ep b/templates/webmail/about.html.ep
index 60fe549..5cee603 100644
--- a/templates/webmail/about.html.ep
+++ b/templates/webmail/about.html.ep
@@ -64,7 +64,7 @@
<tr>
<td>
<nav>
- %= button_to login => 'noaction' => (class => 'link-btn')
+ %= button_to login => 'login' => (class => 'link-btn')
</nav>
</td>
</tr>
diff --git a/templates/webmail/noaction.html.ep b/templates/webmail/login.html.ep
index 2608bda..4b2da5d 100644
--- a/templates/webmail/noaction.html.ep
+++ b/templates/webmail/login.html.ep
@@ -18,7 +18,7 @@
<tr>
<td class=login-form>
- %= form_for login => (name => 'login1') => begin
+ %= form_for login => (name => 'login1') => (method => 'post') => begin
<table>
<tr>