| 1 | package Siesta::Plugin::Challenge; | ||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use Siesta::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use base 'Siesta::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use String::Random(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | # suggested usage set_plugins( subscribe => qw( Challenge Subscribe ) ); | ||||||||||
| 8 | # set_plugins( resume => qw( Resume ) ); | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub description { | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | 1 | 'defer a message and send a challenge'; | |||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=2 SCAR=7.5
Pod
documented
| |||||||||||
| 15 | 1 | my $self = shift; | |||||||||
| 16 | 1 | my $mail = shift; | |||||||||
| 17 | |||||||||||
| 18 | 1 | my $newmember = 0; # is this a new member | |||||||||
| 19 | 1 | my $member = Siesta::Member->load( $mail->from ); | |||||||||
| 20 | 1 | ▶ | unless ($member) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | my $password = String::Random->new->randpattern('......'); | |||||||||
| 22 | 0 | $member = Siesta::Member->create({ email => $mail->from, | |||||||||
| 23 | password => $password }); | ||||||||||
| 24 | 0 | $newmember = 1; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | my $deferred = $mail->defer( who => $member, why => "challenge" ); | |||||||||
| 28 | 1 | $mail->reply( | |||||||||
| 29 | from => $self->list->address( 'resume' ), | ||||||||||
| 30 | body => Siesta->bake( "challenge", | ||||||||||
| 31 | deferred => $deferred, | ||||||||||
| 32 | newmember => $newmember, | ||||||||||
| 33 | ), | ||||||||||
| 34 | ); | ||||||||||
| 35 | 1 | return 1; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 3 | 1; | |||||||||