r96627 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96626‎ | r96627 | r96628 >
Date:22:47, 8 September 2011
Author:brion
Status:ok
Tags:
Comment:
* (bug 30823) Clarify error messages on Special:EmailCapture

"Invalid code" and "already confirmed" are now called out as distinct error responses, so submitting twice by accident doesn't show a scary "failed!" message.
Modified paths:
  • /trunk/extensions/EmailCapture/EmailCapture.i18n.php (modified) (history)
  • /trunk/extensions/EmailCapture/SpecialEmailCapture.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EmailCapture/EmailCapture.i18n.php
@@ -15,6 +15,8 @@
1616 'emailcapture' => 'E-mail verification',
1717 'emailcapture-desc' => 'Capture e-mail addresses, and allow users to verify them through e-mail',
1818 '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.',
1921 'emailcapture-response-subject' => '{{SITENAME}} e-mail address verification',
2022 'emailcapture-response-body' => 'Hello!
2123
Index: trunk/extensions/EmailCapture/SpecialEmailCapture.php
@@ -14,16 +14,28 @@
1515 $code = $wgRequest->getVal( 'verify' );
1616 if ( $code !== null ) {
1717 $dbw = wfGetDB( DB_MASTER );
18 - $dbw->update(
 18+ $row = $dbw->selectRow(
1919 'email_capture',
20 - array( 'ec_verified' => 1 ),
 20+ array( 'ec_verified' ),
2121 array( 'ec_code' => $code ),
2222 __METHOD__
2323 );
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' );
2638 } else {
27 - $wgOut->addWikiMsg( 'emailcapture-failure' );
 39+ $wgOut->addWikiMsg( 'emailcapture-invalid-code' );
2840 }
2941 } else {
3042 // Show simple form for submitting verification code

Follow-up revisions

RevisionCommit summaryAuthorDate
r96850REL1_18: MFT r96006, 96627reedy15:10, 12 September 2011
r968601.17wmf1: MFT r96420, r96627reedy16:30, 12 September 2011

Status & tagging log