| 1 | package WWW::MailboxOrg::API::Passwordreset; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Password reset API | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooX::Singleton; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Params::ValidationCompiler qw(validation_for); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Types::Standard qw(Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.001'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has client => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | weak_ref => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | sub _rpc { | ||||||||||
| 20 | 0 | ▶ | my ($self, $method, @params) = @_; | ||||||||
|
Subroutine
_rpc: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | ▶ | my $client = $self->client or croak "No client set"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | return $client->call($method, @params); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | my %validators = ( | |||||||||
| 26 | request => validation_for( | ||||||||||
| 27 | params => { | ||||||||||
| 28 | account => { type => Str, optional => 0 }, | ||||||||||
| 29 | }, | ||||||||||
| 30 | ), | ||||||||||
| 31 | set => validation_for( | ||||||||||
| 32 | params => { | ||||||||||
| 33 | account => { type => Str, optional => 0 }, | ||||||||||
| 34 | token => { type => Str, optional => 0 }, | ||||||||||
| 35 | newpassword => { type => Str, optional => 0 }, | ||||||||||
| 36 | }, | ||||||||||
| 37 | ), | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | sub request { | ||||||||||
| 41 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
request: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 42 | 0 | my $v = $validators{'request'}; | |||||||||
| 43 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | return $self->_rpc('passwordreset.request', \%params); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | sub set { | ||||||||||
| 48 | 0 | ▶ | my ($self, %params) = @_; | ||||||||
|
Subroutine
set: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 49 | 0 | my $v = $validators{'set'}; | |||||||||
| 50 | 0 | ▶ | %params = $v->(%params) if $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | return $self->_rpc('passwordreset.set', \%params); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 1 | 1; | |||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||
| 57 | |||||||||||
| 58 | =pod | ||||||||||
| 59 | |||||||||||
| 60 | =encoding UTF-8 | ||||||||||
| 61 | |||||||||||
| 62 | =head1 NAME | ||||||||||
| 63 | |||||||||||
| 64 | WWW::MailboxOrg::API::Passwordreset - Password reset API | ||||||||||
| 65 | |||||||||||
| 66 | =head1 VERSION | ||||||||||
| 67 | |||||||||||
| 68 | version 0.001 | ||||||||||
| 69 | |||||||||||
| 70 | =head1 NAME | ||||||||||
| 71 | |||||||||||
| 72 | WWW::MailboxOrg::API::Passwordreset - Password reset API | ||||||||||
| 73 | |||||||||||
| 74 | =head2 request | ||||||||||
| 75 | |||||||||||
| 76 | $api->passwordreset->request(account => 'user@example.com'); | ||||||||||
| 77 | |||||||||||
| 78 | Request password reset. Required: C<account>. | ||||||||||
| 79 | |||||||||||
| 80 | =head2 set | ||||||||||
| 81 | |||||||||||
| 82 | $api->passwordreset->set( | ||||||||||
| 83 | account => 'user@example.com', | ||||||||||
| 84 | token => 'reset-token-from-email', | ||||||||||
| 85 | newpassword => 'newsecret123', | ||||||||||
| 86 | ); | ||||||||||
| 87 | |||||||||||
| 88 | Set new password. Required: C<account>, C<token>, C<newpassword>. | ||||||||||
| 89 | |||||||||||
| 90 | =cut | ||||||||||
| 91 | |||||||||||
| 92 | =head1 SUPPORT | ||||||||||
| 93 | |||||||||||
| 94 | =head2 Issues | ||||||||||
| 95 | |||||||||||
| 96 | Please report bugs and feature requests on GitHub at | ||||||||||
| 97 | L<https://github.com/getty/p5-www-mailboxorg/issues>. | ||||||||||
| 98 | |||||||||||
| 99 | =head2 IRC | ||||||||||
| 100 | |||||||||||
| 101 | Join C<#perl-help> on C<irc.perl.org> or message Getty directly. | ||||||||||
| 102 | |||||||||||
| 103 | =head1 CONTRIBUTING | ||||||||||
| 104 | |||||||||||
| 105 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||
| 106 | |||||||||||
| 107 | =head1 AUTHOR | ||||||||||
| 108 | |||||||||||
| 109 | Torsten Raudssus <getty@cpan.org> | ||||||||||
| 110 | |||||||||||
| 111 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 112 | |||||||||||
| 113 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||
| 114 | |||||||||||
| 115 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 116 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 117 | |||||||||||
| 118 | =cut | ||||||||||