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/ReadMails/MockJSON.pm | |
parent | e740d60265adacfef6edb6b534ae31eedf9011da (diff) |
propper cram support (baring some details rng)
Diffstat (limited to 'lib/JWebmail/Model/ReadMails/MockJSON.pm')
-rw-r--r-- | lib/JWebmail/Model/ReadMails/MockJSON.pm | 7 |
1 files changed, 6 insertions, 1 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; } |