Framework  3.9
SignatureValidator Class Reference

Validates that the user's supplied password is correct. More...

+ Inheritance diagram for SignatureValidator:
+ Collaboration diagram for SignatureValidator:

Public Member Functions

 SignatureValidator ($field, $title, $msg, $test="password")
 Create a new SignatureValidator. More...
 
 writeScript ()
 
 validate ()
 
- Public Member Functions inherited from AbstractValidator
 AbstractValidator ($field, $title)
 
 writeClient ()
 

Public Attributes

 $msg
 The error message to report if there is a mismatch. More...
 
 $empty = ""
 Empty value for the control. More...
 
 $test = "password"
 Field to match. More...
 
- Public Attributes inherited from AbstractValidator
 $field
 
 $title
 

Detailed Description

Validates that the user's supplied password is correct.

Author
andy

Definition at line 1815 of file validation.inc.

Member Function Documentation

◆ SignatureValidator()

SignatureValidator::SignatureValidator (   $field,
  $title,
  $msg,
  $test = "password" 
)

Create a new SignatureValidator.

Parameters
string$field
string$title
string$msg

Definition at line 1827 of file validation.inc.

1828  {
1829  $this->AbstractValidator($field, $title);
1830  $this->msg = $msg;
1831  $this->test = $test;
1832  }
AbstractValidator($field, $title)
Definition: validation.inc:53
$test
Field to match.
$msg
The error message to report if there is a mismatch.

◆ validate()

SignatureValidator::validate ( )

Reimplemented from AbstractValidator.

Definition at line 1839 of file validation.inc.

1840  {
1841  global $_POST;
1842  global $user;
1843 
1844  $value = $_POST[$this->field];
1845 
1846  if (isset($value) && $value !== $this->empty)
1847  {
1848  if ($this->test == "password")
1849  {
1850  $hash = $user->hashPassword($value, $user->password);
1851 
1852  if($user->password == $hash)
1853  return "";
1854  else
1855  {
1856  trace("Signature Validator::invalid signature", 3);
1857  return $this->msg;
1858  }
1859  }
1860  else
1861  {
1862  if ($user->get($this->test) == $value) return "";
1863  return $this->msg;
1864  }
1865  }
1866  }
trace($msg, $lvl=3, $callStack=null)
Send output to the trace log.
Definition: functions.inc:1010

◆ writeScript()

SignatureValidator::writeScript ( )

Definition at line 1834 of file validation.inc.

1835  {
1836  // no client side validation
1837  }

Member Data Documentation

◆ $empty

SignatureValidator::$empty = ""

Empty value for the control.

Definition at line 1818 of file validation.inc.

◆ $msg

SignatureValidator::$msg

The error message to report if there is a mismatch.

Definition at line 1817 of file validation.inc.

◆ $test

SignatureValidator::$test = "password"

Field to match.

Definition at line 1819 of file validation.inc.


The documentation for this class was generated from the following file: