cvs: pearweb /public_html account-request-vote.php /sql election.sql pearweb_mdb2schema.xml
| From: | Greg Beaver | Date: | Sun, 03 Dec 2006 06:11:39 +0000 |
| Subject: | cvs: pearweb /public_html account-request-vote.php /sql election.sql pearweb_mdb2schema.xml | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-5237@lists.php.net to get a copy of this message | ||
cellog Sun Dec 3 06:11:39 2006 UTC
Modified files:
/pearweb/public_html account-request-vote.php
/pearweb/sql election.sql pearweb_mdb2schema.xml
Log:
* implement Request #9527: Implement automatic voter registration (arnaud, cellog)
http://cvs.php.net/viewvc.cgi/pearweb/public_html/account-request-vote.php?r1=1.4&r2=1.5&diff_format=u
Index: pearweb/public_html/account-request-vote.php
diff -u pearweb/public_html/account-request-vote.php:1.4
pearweb/public_html/account-request-vote.php:1.5
--- pearweb/public_html/account-request-vote.php:1.4 Wed Nov 29 04:03:57 2006
+++ pearweb/public_html/account-request-vote.php Sun Dec 3 06:11:39 2006
@@ -15,13 +15,14 @@
+----------------------------------------------------------------------+
| Authors: |
+----------------------------------------------------------------------+
- $Id: account-request-vote.php,v 1.4 2006/11/29 04:03:57 cellog Exp $
+ $Id: account-request-vote.php,v 1.5 2006/12/03 06:11:39 cellog Exp $
*/
define('HTML_FORM_TH_ATTR', 'class="form-label_left"');
define('HTML_FORM_TD_ATTR', 'class="form-input"');
require_once 'HTML/Form.php';
require_once 'Damblan/Mailer.php';
+require_once 'election/pear-election-accountrequest.php';
$display_form = true;
$width = 60;
@@ -64,11 +65,9 @@
break;
}
- // hard-code this data
- $stripped['purpose'] = 'vote in general election';
-
- // The add method performs further validation then creates the acct
- $ok = user::add($stripped);
+ $request = new PEAR_Election_Accountrequest();
+ $salt = $request->addRequest($stripped['handle'],
$stripped['email'],
+ $stripped['firstname'], $stripped['lastname'], $stripped);
if (!empty($stripped['jumpto'])) {
$jumpto = $stripped['jumpto'];
@@ -78,33 +77,28 @@
$display_form = $stripped['display_form'];
}
- if (is_array($ok)) {
- $errors = $ok;
+ if (is_array($salt)) {
+ $errors = $salt;
break;
- } elseif ($ok === true) {
- report_success('Your account request has been submitted, it will'
- . ' be reviewed by a human shortly. This may take from'
- . ' two minutes to several days, depending on how much'
- . ' time people have.'
- . ' You will get an email when your account is open,'
- . ' or if your request was rejected for some reason.');
+ } elseif (strlen($salt) == 32) {
+ report_success('Your account request confirmation has been submitted, '
+ . ' You must follow the link provided in the email '
+ . ' in order to activate your account.'
+ . ' Until this is done you cannot vote in any election.');
$mailData = array(
'username' => $stripped['handle'],
- 'firstname' => $stripped['firstname'],
- 'lastname' => $stripped['lastname'],
+ 'salt' => $salt,
);
if (!DEVBOX) {
$mailer = Damblan_Mailer::create('pearweb_account_request_vote',
$mailData);
- $additionalHeaders['To'] = '"Arnaud Limbourg"
<arnaud@limbourg.com>';
+ $additionalHeaders['To'] = $stripped['email'];
$mailer->send($additionalHeaders);
}
- } elseif ($ok === false) {
- $msg = 'Your account request has been submitted, but there'
- . ' were problems mailing one or more administrators.'
- . ' If you don\'t hear anything about your account in'
- . ' a few days, please drop a mail about it to the'
+ } elseif ($salt === false) {
+ $msg = 'Your account cannot be added to the queue.'
+ . ' Please drop a mail to the '
. ' <i>pear-dev</i> mailing list.';
report_error($msg, 'warnings', 'WARNING:');
}
http://cvs.php.net/viewvc.cgi/pearweb/sql/election.sql?r1=1.5&r2=1.6&diff_format=u
Index: pearweb/sql/election.sql
diff -u pearweb/sql/election.sql:1.5 pearweb/sql/election.sql:1.6
--- pearweb/sql/election.sql:1.5 Fri Nov 10 04:13:53 2006
+++ pearweb/sql/election.sql Sun Dec 3 06:11:39 2006
@@ -60,3 +60,12 @@
votetotal BIGINT NOT NULL,
PRIMARY KEY (election_id, choice)
);
+
+CREATE TABLE election_account_request (
+ id INT NOT NULL AUTO_INCREMENT,
+ created_on DATE NOT NULL,
+ handle VARCHAR(20) NOT NULL,
+ salt CHAR(32) NOT NULL,
+ email VARCHAR(65) NOT NULL,
+ PRIMARY KEY(id)
+);
http://cvs.php.net/viewvc.cgi/pearweb/sql/pearweb_mdb2schema.xml?r1=1.14&r2=1.15&diff_format=u
Index: pearweb/sql/pearweb_mdb2schema.xml
diff -u pearweb/sql/pearweb_mdb2schema.xml:1.14 pearweb/sql/pearweb_mdb2schema.xml:1.15
--- pearweb/sql/pearweb_mdb2schema.xml:1.14 Fri Dec 1 21:07:00 2006
+++ pearweb/sql/pearweb_mdb2schema.xml Sun Dec 3 06:11:39 2006
@@ -2886,4 +2886,59 @@
</declaration>
</table>
+
+ <table>
+
+ <name>election_account_request</name>
+
+ <declaration>
+
+ <field>
+ <name>id</name>
+ <type>integer</type>
+ <length>11</length>
+ <notnull>true</notnull>
+ <autoincrement>true</autoincrement>
+ </field>
+
+ <field>
+ <name>created_on</name>
+ <type>date</type>
+ <notnull>true</notnull>
+ </field>
+
+ <field>
+ <name>handle</name>
+ <type>text</type>
+ <length>20</length>
+ <notnull>true</notnull>
+ </field>
+
+ <field>
+ <name>salt</name>
+ <type>text</type>
+ <length>32</length>
+ <notnull>true</notnull>
+ </field>
+
+ <field>
+ <name>email</name>
+ <type>text</type>
+ <length>65</length>
+ <notnull>true</notnull>
+ </field>
+
+ <index>
+ <name>primary</name>
+ <primary>true</primary>
+ <field>
+ <name>id</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>
+
+ </declaration>
+
+ </table>
+
</database>