rev 1315 - in trunk/siesta: . lib/Siesta/Plugin messages

[prev] [thread] [next] [lurker] [Date index for 2003/08/11]

From: richardc
Subject: rev 1315 - in trunk/siesta: . lib/Siesta/Plugin messages
Date: 19:12 on 11 Aug 2003
Author: richardc
Date: 2003-08-11 19:12:23 +0100 (Mon, 11 Aug 2003)
New Revision: 1315

Modified:
   trunk/siesta/Build.PL
   trunk/siesta/lib/Siesta/Plugin/Challenge.pm
   trunk/siesta/lib/Siesta/Plugin/Subscribe.pm
   trunk/siesta/messages/subscribe_reply
Log:
autogenerate passwords

Modified: trunk/siesta/Build.PL
===================================================================
--- trunk/siesta/Build.PL	2003-08-11 13:52:27 UTC (rev 1314)
+++ trunk/siesta/Build.PL	2003-08-11 18:12:23 UTC (rev 1315)
@@ -11,6 +11,7 @@
                           'Class::Accessor::Fast' => 0,
                           'Class::DBI::BaseDSN' => 0,
                           'Class::DBI::SQLite' => 0,
+                          'Crypt::RandPasswd' => 0,
                           'Digest::MD5' => 0,
                           'Email::Folder' => 0,
                           'Email::Simple' => '1.4',

Modified: trunk/siesta/lib/Siesta/Plugin/Challenge.pm
===================================================================
--- trunk/siesta/lib/Siesta/Plugin/Challenge.pm	2003-08-11 13:52:27 UTC (rev 1314)
+++ trunk/siesta/lib/Siesta/Plugin/Challenge.pm	2003-08-11 18:12:23 UTC (rev 1315)
@@ -1,6 +1,7 @@
 package Siesta::Plugin::Challenge;
 use strict;
 use Siesta::Plugin;
+use Crypt::RandPasswd;
 use base 'Siesta::Plugin';
 
 # suggested usage  set_plugins( subscribe => qw( Challenge Subscribe ) );
@@ -17,8 +18,9 @@
     my $newmember = 0;     # is this a new member
     my $member = Siesta::Member->load( $mail->from );
     unless ($member) {
+        my $password = Crypt::RandPasswd->word(6, 10);
         $member = Siesta::Member->create({ email    => $mail->from,
-                                           password => 'XXX_autogenerate_me' });
+                                           password => $password });
         $newmember = 1;
     }
 

Modified: trunk/siesta/lib/Siesta/Plugin/Subscribe.pm
===================================================================
--- trunk/siesta/lib/Siesta/Plugin/Subscribe.pm	2003-08-11 13:52:27 UTC (rev 1314)
+++ trunk/siesta/lib/Siesta/Plugin/Subscribe.pm	2003-08-11 18:12:23 UTC (rev 1315)
@@ -3,6 +3,7 @@
 use strict;
 use Siesta::Plugin;
 use base 'Siesta::Plugin';
+use Crypt::RandPasswd;
 
 sub description {
     'A system plugin used for subscribing a member to the list';
@@ -22,7 +23,14 @@
         return 1;
     }
 
-    my $user = Siesta::Member->find_or_create({ email => $email });
+    my $user = Siesta::Member->load( $email );
+    my $newuser;
+    unless ($user) {
+        my $password = Crypt::RandPasswd->word(6, 10);
+        $user = Siesta::Member->create({ email    => $email,
+                                         password => $password });
+        $newuser = 1;
+    }
 
     # add the user to the list and if that fails, send an error
     unless ( $list->add_member( $user ) ) {
@@ -38,6 +46,7 @@
                   body => Siesta->bake('subscribe_notify',
                                        list    => $list,
                                        user    => $user,
+                                       newuser => $newuser,
                                        message => $mail )
                  );
 

Modified: trunk/siesta/messages/subscribe_reply
===================================================================
--- trunk/siesta/messages/subscribe_reply	2003-08-11 13:52:27 UTC (rev 1314)
+++ trunk/siesta/messages/subscribe_reply	2003-08-11 18:12:23 UTC (rev 1315)
@@ -1,5 +1,7 @@
 Hi,
  You have been successfully subscribed to [% list.name %]
 
+[% IF newuser %]In addition an account has created for you with the password [% user.password %][% END %]
+
 Enjoy,
 - Siesta::Plugin::Subscribe

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52