diff options
author | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-04-26 02:38:13 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-04-26 02:38:13 +0200 |
commit | 8387d8eb466e1187ee6caeaeb773d67652797731 (patch) | |
tree | 0f3af0439d67c836b36108e4339900b1a2fcded6 /lib/JWebmail/Controller | |
parent | affff46cea8dad31bb850ec27ba2a57f123e681b (diff) |
put auth into the stash
Diffstat (limited to 'lib/JWebmail/Controller')
-rw-r--r-- | lib/JWebmail/Controller/Webmail.pm | 28 |
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'); |