r98486 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98485‎ | r98486 | r98487 >
Date:23:06, 29 September 2011
Author:jpostlethwaite
Status:ok
Tags:fundraising 
Comment:
Enabled User::isValidEmailAddr() validator.
Modified paths:
  • /branches/fundraising/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)

Diff [purge]

Index: branches/fundraising/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -128,7 +128,7 @@
129129 * - address - Validates: street, city, state, zip
130130 * - amount - Validates: amount
131131 * - creditCard - Validates: card_num, cvv, expiration and sets the card
132 - * - email - Validates: email - NOTE: part of this validation is disabled
 132+ * - email - Validates: email
133133 * - name - Validates: fname, lname
134134 *
135135 * @return 0|1 Returns 0 on success and 1 on failure
@@ -304,10 +304,6 @@
305305 /**
306306 * Validates an email address.
307307 *
308 - * @todo
309 - * - is this a bug? isEmail -> email :: This is fixed in this method.
310 - *
311 - *
312308 * @param array $data Reference to the data of the form
313309 * @param array $error Reference to the error messages of the form
314310 *
@@ -317,20 +313,20 @@
318314
319315 if ( empty( $data['email'] ) ) {
320316
321 - $error['email'] = "**" . wfMsg( $gateway_identifier . '_gateway-error-emailAdd' ) . "**<br />";
 317+ $error['email'] = wfMsg( $gateway_identifier . '_gateway-error-email-empty' );
322318
323319 $this->setValidateFormResult( false );
324320 }
325321
326 -// // is email address valid?
327 -// $isEmail = User::isValidEmailAddr( $data['emailAdd'] );
328 -//
329 -// // create error message (supercedes empty field message)
330 -// if ( !$isEmail ) {
331 -// $error['emailAdd'] = wfMsg( $this->adapter->getIdentifier() . '_gateway-error-msg-email' );
332 -//
333 -// $this->setValidateFormResult( false );
334 -// }
 322+ // is email address valid?
 323+ $isEmail = User::isValidEmailAddr( $data['email'] );
 324+
 325+ // create error message (supercedes empty field message)
 326+ if ( !$isEmail ) {
 327+ $error['email'] = wfMsg( $this->adapter->getIdentifier() . '_gateway-error-msg-email' );
 328+
 329+ $this->setValidateFormResult( false );
 330+ }
335331 }
336332
337333 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98476Added GatewayForm::validateForm() so certain elements can be validated. The o...jpostlethwaite22:19, 29 September 2011

Status & tagging log