diff options
author | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-05-05 14:41:10 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-05-05 14:41:10 +0200 |
commit | febfd792ce3a63314c980cc29440cf2f127953b4 (patch) | |
tree | 196b98d1ead81459869aa4675fd7a198b0d7822b /lib/JWebmail/Model | |
parent | e740d60265adacfef6edb6b534ae31eedf9011da (diff) |
propper cram support (baring some details rng)
Diffstat (limited to 'lib/JWebmail/Model')
-rw-r--r-- | lib/JWebmail/Model/ReadMails/MockJSON.pm | 7 | ||||
-rw-r--r-- | lib/JWebmail/Model/ReadMails/Role.pm | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/JWebmail/Model/ReadMails/MockJSON.pm b/lib/JWebmail/Model/ReadMails/MockJSON.pm index 7decb7d..345573c 100644 --- a/lib/JWebmail/Model/ReadMails/MockJSON.pm +++ b/lib/JWebmail/Model/ReadMails/MockJSON.pm @@ -6,8 +6,9 @@ use utf8; use List::Util 'sum'; -use Mojo::JSON qw(decode_json); +use Mojo::JSON 'decode_json'; +use Digest::HMAC_MD5 'hmac_md5_hex'; use Role::Tiny::With; use namespace::clean; @@ -51,6 +52,10 @@ sub verify_user { my $self = shift; my $auth = shift; + if ($auth->{challenge}) { + my $res = hmac_md5_hex($auth->{challenge}, VALID_PW); + return $auth->{user} eq VALID_USER && $auth->{password} eq $res; + } return $auth->{user} eq VALID_USER && $auth->{password} eq VALID_PW; } diff --git a/lib/JWebmail/Model/ReadMails/Role.pm b/lib/JWebmail/Model/ReadMails/Role.pm index d6472a1..466e3b0 100644 --- a/lib/JWebmail/Model/ReadMails/Role.pm +++ b/lib/JWebmail/Model/ReadMails/Role.pm @@ -20,7 +20,7 @@ sub Auth { state $AuthCheck = { user => {defined => 1, required => 1}, password => {defined => 1, required => 1}, - challenge => {defined => 1}, + challenge => {}, }; my $self = @_ == 1 ? $_[0] : {@_}; |