[Yapcom checkin] rev 13 - / lib/YAPC templates

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

From: svn
Subject: [Yapcom checkin] rev 13 - / lib/YAPC templates
Date: 12:41 on 24 Nov 2003
Author: gabor
Date: 2003-11-24 12:41:33 +0200 (Mon, 24 Nov 2003)
New Revision: 13

Modified:
   MANIFEST
   META.yml
   README
   lib/YAPC/Organizer.pm
   templates/user_account.tmpl
Log:
add interface for users to change their password

Modified: MANIFEST
===================================================================
--- MANIFEST	2003-11-24 08:30:43 UTC (rev 12)
+++ MANIFEST	2003-11-24 10:41:33 UTC (rev 13)
@@ -26,6 +26,7 @@
 t/04-proposals.t                  no
 t/05-web-proposals.t              no
 t/07-web-change-data.t            no
+t/09-web-chnage-password.t        no
 t/10-use-html-template.t          no
 t/11-web-admin.t                  no
 t/lib/YAPC/Test.pm                no
@@ -61,8 +62,9 @@
 templates/email_sent.tmpl
 templates/lost_password.tmpl
 templates/lost_validation.tmpl
+templates/change_password.tmpl
+templates/message.tmpl
 docs/announcement_call_for_papers_hebrew.doc
 docs/announcement_call_for_papers_english.doc
 docs/sponsorship_letter_hebrew.doc
 
-

Modified: META.yml
===================================================================
--- META.yml	2003-11-24 08:30:43 UTC (rev 12)
+++ META.yml	2003-11-24 10:41:33 UTC (rev 13)
@@ -1,13 +1,14 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Yapcom
-version:      0.07_01
+version:      0.07_02
 version_from: lib/YAPC/Organizer.pm
 installdirs:  site
 requires:
     CGI:                           0
     CGI::Application:              0
     Class::DBI::BaseDSN:           0
+    Class::DBI::SQLite:            0
     Data::Dumper:                  0
     DBD::SQLite:                   0
     HTML::Template:                0

Modified: README
===================================================================
--- README	2003-11-24 08:30:43 UTC (rev 12)
+++ README	2003-11-24 10:41:33 UTC (rev 13)
@@ -34,14 +34,14 @@
 
 CHANGES
 ---------
-0.07_02 2003.11.
+0.07_02 2003.11.24
     - further refactoring the tests
     - add pages to get back lost password and get validation code again
         if e-mail was not yet validated.
     - make list of proposal lengths configurable and add 180 min too
     - make list of languages configurable
     - create admin interface to list all the people with all their properties.
-    
+    - interface for the users to change password
 
 0.07_01 2003.11.15
     - send e-mail on every registration to administrator
@@ -138,8 +138,8 @@
      original release with script to handle the templates of the simple web site. 
 
 
-TODO
--------
+TODO   (not necessarily in order of importance)
+------------------------------------------------
     - separate the code (with simple templates) and the templates needed for
       YAPC::Israel::2004. Put the former in  the distribution, move the
       latter to manual change and upload.
@@ -150,7 +150,6 @@
       any) will be shared with the world.
 
     - form (for logged in user) to change the personal information registerd 
-      (probably separate form to change password)
       for now cannot change e-mail address as for that we'll need a separate field
       in the database to save the new e-mail till validated.
     - form (for logged in user) to list all of his/her proposals, delete them or change them.
@@ -158,10 +157,8 @@
     - improve error messages on the web site
     - give error message on validation form if something went wrong
 
-
     - testing the various e-mail sending routines
 
-
     - test and fix case when non-existing runmode was supplied
 
     - try to break the system/web interface and then fix it :-)
@@ -173,14 +170,17 @@
 
     - write tests that test the real forms with a real web server infront of them.
 
-
     - allow registrant to be anonymous (not to show in the public interface, but
       only if they don't give presentations)
     - ask for mobile phone number as well.
 
     - on the list_people page show stat of how many people have paid already.
 
+    - administrator should be able to set a person as 'invalid'.
+      I think we need this as some people will subscribe just for their own
+        fun and taint our database.
 
+
     - change the directory tree after the installation so the data files, cgi scripts 
       and library files will not be in the reachable path.
 

Modified: lib/YAPC/Organizer.pm
===================================================================
--- lib/YAPC/Organizer.pm	2003-11-24 08:30:43 UTC (rev 12)
+++ lib/YAPC/Organizer.pm	2003-11-24 10:41:33 UTC (rev 13)
@@ -34,6 +34,7 @@
               'login'         => 'do_login',
               'logout'        => 'do_logout',
               'send_proposal' => 'do_send_proposal',
+              'change_password' => 'do_change_password',
               'get_validation_code' => 'get_validation_code',
               'get_lost_password' => 'get_lost_password',
                );
@@ -79,7 +80,7 @@
         my $t = $self->_server_page('user_account', "$templates_dir/user_account.tmpl");
         return $t->output;
     }
-    my @user_pages = qw(proposal user_account personal_info);  # list pages that require valid login to access
+    my @user_pages = qw(proposal user_account personal_info change_password);  # list pages that require valid login to access
     my @admin_pages = qw(admin admin_list_people admin_list_proposals); # list of pages accessible to administrators only
 
     if (not $id and 
@@ -122,6 +123,39 @@
 }
 
 
+sub do_change_password {
+    my $self = shift;
+    my $q = $self->query;
+
+    # is user logged in ?
+    my $cookie = $q->cookie('Yapcom');
+    my $id = YAPC::Login->get_user_id(cookie => $cookie);
+    if (not $id) {
+        my $t = $self->_server_page('login', "$templates_dir/login.tmpl");
+        $t->param(next => "change_password.html");
+        return $t->output;
+    }
+
+    # are the password good and equal ?
+    if (defined $q->param('password') and
+        defined $q->param('password2') and
+        ($q->param('password') eq $q->param('password2'))) {
+        
+        # update database
+        my ($person) = YAPC::Person->search(id => $id);
+        $person->password($q->param('password'));
+        $person->update();
+
+        my $t = $self->_server_page('message', "$templates_dir/message.tmpl");
+        $t->param(password_changed => 1);
+        return $t->output;
+    } else {
+        my $t = $self->_server_page('change_password', "$templates_dir/change_password.tmpl");
+        $t->param(message => "Error");
+        return $t->output;
+    }
+}
+
 sub get_validation_code {
     my $self = shift;
     my $q = $self->query;

Modified: templates/user_account.tmpl
===================================================================
--- templates/user_account.tmpl	2003-11-24 08:30:43 UTC (rev 12)
+++ templates/user_account.tmpl	2003-11-24 10:41:33 UTC (rev 13)
@@ -5,6 +5,7 @@
 Some user information will be here.
 <p>
 <a href=proposal.html>Submit a proposal</a><br>
+<a href=change_password.html>Change password</a><br>
 <a href=logout.html>Logout</a><br>
 
          <br />&nbsp;<br /><br />&nbsp;<br /><br />&nbsp;<br /><br />&nbsp;<br /><br />&nbsp;<br />

Generated at 15:06 on 24 Nov 2003 by mariachi 0.51