I would like to check access time before login if out of time then show error massage
LoginForm.php
public function authenticate($attribute,$params)
{
if(!$this->hasErrors())
{
$this->_identity=new UserIdentity($this->username,$this->password);
if(!$this->_identity->authenticate()){
$this->addError('password','Incorrect username or password.');
}
else if($this->_identity->authenticate() == 3){
$this->addError('password', 'You can not access this time.');
}
}
}
UserIdentity.php
if(!isset($user)){ // === NULL
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
else if(!$user->validatePassword($this->password)){ // !== Password
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
else if($time_now >= '12:00:00'){
$this->errorCode=self::ERROR_TIME_INVALID;
return $this->errorCode;
}
else{
$this->username = $user->NAME;