Skip to content

Commit

Permalink
Validate user input for the Code Expiry setting of the Password and A…
Browse files Browse the repository at this point in the history
…ctivation fields. RE: #151
  • Loading branch information
Brendan Abbott committed May 28, 2011
1 parent 26bee2d commit b8406f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fields/field.memberactivation.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ public function checkFields(&$errors, $checkForDuplicates=true) {
if (trim($this->get('code_expiry')) == '') {
$errors['code_expiry'] = __('This is a required field.');
}

if(!DateTimeObj::validate($this->get('code_expiry'))) {
$errors['code_expiry'] = __('Code expiry must be a unit of time, such as <code>1 day</code> or <code>2 hours</code>');
}
}

public function commit(){
Expand Down
4 changes: 4 additions & 0 deletions fields/field.memberpassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ public function checkFields(&$errors, $checkForDuplicates = true) {
if (trim($this->get('code_expiry')) == '') {
$errors['code_expiry'] = __('This is a required field.');
}

if(!DateTimeObj::validate($this->get('code_expiry'))) {
$errors['code_expiry'] = __('Code expiry must be a unit of time, such as <code>1 day</code> or <code>2 hours</code>');
}
}

public function commit(){
Expand Down

0 comments on commit b8406f5

Please sign in to comment.