summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/Controller')
-rw-r--r--lib/JWebmail/Controller/Webmail.pm28
1 files changed, 8 insertions, 20 deletions
diff --git a/lib/JWebmail/Controller/Webmail.pm b/lib/JWebmail/Controller/Webmail.pm
index 6754ac7..f0d45b3 100644
--- a/lib/JWebmail/Controller/Webmail.pm
+++ b/lib/JWebmail/Controller/Webmail.pm
@@ -33,6 +33,10 @@ sub auth {
return 0;
}
+ my $authConf = {user => $user, password => $pw};
+ $authConf->{challenge} = $self->app->secrets->[0] if $self->config->{session}{secure} eq 'cram';
+ $self->stash(auth => $self->users->Auth($authConf));
+
return 1;
}
@@ -114,11 +118,7 @@ sub displayheaders {
no warnings 'experimental::smartmatch';
my $self = shift;
- my $auth = $self->users->Auth(
- user => $self->session(S_USER),
- password => $self->session_passwd,
- challenge => $self->app->secrets->[0],
- );
+ my $auth = $self->stash('auth');
my $folders = _time { $self->users->folders($auth) } $self, 'user folders';
@@ -178,11 +178,7 @@ sub readmail {
my $mid = $self->stash('id');
- my $auth = $self->users->Auth(
- user => $self->session(S_USER),
- password => $self->session_passwd,
- challenge => $self->app->secrets->[0],
- );
+ my $auth = $self->stash('auth');
my $mail;
eval { $mail = $self->users->show($auth, $mid) };
@@ -203,11 +199,7 @@ sub raw {
my $mid = $self->stash('id');
- my $auth = $self->users->Auth(
- user => $self->session(S_USER),
- password => $self->session_passwd,
- challenge => $self->app->secrets->[0],
- );
+ my $auth = $self->stash('auth');
my $mail = $self->users->show($auth, $mid);
@@ -291,11 +283,7 @@ sub move {
return;
}
- my $auth = $self->users->Auth(
- user => $self->session(S_USER),
- password => $self->session_passwd,
- challenge => $self->app->secrets->[0],
- );
+ my $auth = $self->stash('auth');
my $folders = $self->users->folders($auth);
my $mm = $self->every_param('mail');