Index: trunk/extensions/EmailCapture/EmailCapture.i18n.php |
— | — | @@ -15,6 +15,8 @@ |
16 | 16 | 'emailcapture' => 'E-mail verification', |
17 | 17 | 'emailcapture-desc' => 'Capture e-mail addresses, and allow users to verify them through e-mail', |
18 | 18 | 'emailcapture-failure' => "Your e-mail was '''not''' verified.", |
| 19 | + 'emailcapture-invalid-code' => 'Invalid confirmation code.', |
| 20 | + 'emailcapture-already-confirmed' => 'Your e-mail address has already been confirmed.', |
19 | 21 | 'emailcapture-response-subject' => '{{SITENAME}} e-mail address verification', |
20 | 22 | 'emailcapture-response-body' => 'Hello! |
21 | 23 | |
Index: trunk/extensions/EmailCapture/SpecialEmailCapture.php |
— | — | @@ -14,16 +14,28 @@ |
15 | 15 | $code = $wgRequest->getVal( 'verify' ); |
16 | 16 | if ( $code !== null ) { |
17 | 17 | $dbw = wfGetDB( DB_MASTER ); |
18 | | - $dbw->update( |
| 18 | + $row = $dbw->selectRow( |
19 | 19 | 'email_capture', |
20 | | - array( 'ec_verified' => 1 ), |
| 20 | + array( 'ec_verified' ), |
21 | 21 | array( 'ec_code' => $code ), |
22 | 22 | __METHOD__ |
23 | 23 | ); |
24 | | - if ( $dbw->affectedRows() ) { |
25 | | - $wgOut->addWikiMsg( 'emailcapture-success' ); |
| 24 | + if ( $row && !$row->ec_verified ) { |
| 25 | + $dbw->update( |
| 26 | + 'email_capture', |
| 27 | + array( 'ec_verified' => 1 ), |
| 28 | + array( 'ec_code' => $code ), |
| 29 | + __METHOD__ |
| 30 | + ); |
| 31 | + if ( $dbw->affectedRows() ) { |
| 32 | + $wgOut->addWikiMsg( 'emailcapture-success' ); |
| 33 | + } else { |
| 34 | + $wgOut->addWikiMsg( 'emailcapture-failure' ); |
| 35 | + } |
| 36 | + } else if ( $row && $row->ec_verified ) { |
| 37 | + $wgOut->addWikiMsg( 'emailcapture-already-confirmed' ); |
26 | 38 | } else { |
27 | | - $wgOut->addWikiMsg( 'emailcapture-failure' ); |
| 39 | + $wgOut->addWikiMsg( 'emailcapture-invalid-code' ); |
28 | 40 | } |
29 | 41 | } else { |
30 | 42 | // Show simple form for submitting verification code |