diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-26 21:36:27 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-26 21:36:27 +0100 |
commit | 2abf462ca10c4ac8c4f815e608cad31851e966e3 (patch) | |
tree | ed18c4a4039a5972edc0b81ed79c9d57480f8e70 /lib/JWebmail/Model/ReadMails/Role.pm | |
parent | d0ffe11bd365b68d4da252b39d06d99f75d8cacb (diff) |
Specified the interface for qmauth
Changes to configuration
Added qmauth version written in Python
Slight changes to pagination
Diffstat (limited to 'lib/JWebmail/Model/ReadMails/Role.pm')
-rw-r--r-- | lib/JWebmail/Model/ReadMails/Role.pm | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/JWebmail/Model/ReadMails/Role.pm b/lib/JWebmail/Model/ReadMails/Role.pm index 1f4390b..d6fa1e5 100644 --- a/lib/JWebmail/Model/ReadMails/Role.pm +++ b/lib/JWebmail/Model/ReadMails/Role.pm @@ -1,6 +1,6 @@ package JWebmail::Model::ReadMails::Role; -use Params::Check 'check'; +use Params::Check qw(check last_error); use Mojo::Base -role; # load after imports @@ -18,13 +18,15 @@ package JWebmail::Model::ReadMails::Role::Shadow { sub Auth { shift; state $AuthCheck = { - user => {defined => 1, required => 1}, - password => {defined => 1, required => 1}, + user => {required => 1, defined => 1}, + password => {required => 1, defined => 1}, challenge => {}, }; my $self = @_ == 1 ? $_[0] : {@_}; - my $res = check($AuthCheck, $self, 0) || die Params::Check::last_error; + local $Params::Check::WARNINGS_FATAL = 1; + my $res = check($AuthCheck, $self, 0) + or die 'Auth creation failed! ' . last_error; $res->{password} = JWebmail::Model::ReadMails::Role::Shadow->new($res->{password}); return $res; } @@ -36,14 +38,14 @@ my @methods = ( # ^ throws exception # ^type throws exception of type # Read operations - 'verify_user', # auth:Auth -> :truthy - 'read_headers_for', # auth:Auth, *folder='', *start=0, *end=24, *sort='date' -> ^ :hashref 'count', # auth:Auth, folder -> ^ size:int count:int new:int - 'show', # auth:Auth, mid -> ^ :hashref - 'search', # auth:Auth, pattern, folder -> ^ :hashref 'folders', # auth:Auth -> ^ :arrayref + 'verify_user', # auth:Auth -> :truthy # Write operations 'move', # auth:Auth, mid, folder -> ^ 1 + 'read_headers_for', # auth:Auth, *folder='', *start=0, *end=24, *sort='date' -> ^ :hashref + 'search', # auth:Auth, pattern, folder -> ^ :hashref + 'show', # auth:Auth, mid -> ^ :hashref ); requires(@methods); @@ -66,13 +68,14 @@ around read_headers_for => sub { my $args = {@_}; state $ArgsCheck = { - start => {default => 0}, - end => {default => 24}, - sort => {default => 'date'}, + start => {required => 1}, + end => {required => 1}, + sort => {default => ''}, folder => {default => ''}, }; - $orig->($self, $auth, %{ check($ArgsCheck, $args, 1) }) + local $Params::Check::ONLY_ALLOW_DEFINED = 1; + $orig->($self, $auth, %{ check($ArgsCheck, $args, 0) or die last_error }) }; @@ -107,7 +110,7 @@ Provides bundeled information on a subset of mails of a mailbox. Can be sorted and of varying size. Arguments: - start..end inclusive 0 based range + start..end half open 0 based range =head2 count @@ -150,5 +153,3 @@ Optinal challange for when you use cram authentication. =head1 SEE ALSO L<JWebmail::Model::ReadMails::QMailAuthuser>, L<JWebmail::Model::ReadMails::Mock>, L<JWebmail> - -=cut |