Created
August 28, 2014 16:44
-
-
Save DrMabuse23/11b8ee985da2f33a1489 to your computer and use it in GitHub Desktop.
ip2long problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Logs in a user using the provided username and password. | |
* | |
* @return boolean whether the user is logged in successfully | |
*/ | |
public function login() | |
{ | |
if ($this->validate()) { | |
$this->user->setAttribute('logged_in_from', ip2long(\Yii::$app->getRequest()->getUserIP())); | |
$this->user->setAttribute('logged_in_at', time()); | |
$this->user->save(false); | |
return \Yii::$app->getUser()->login($this->user, $this->rememberMe ? $this->module->rememberFor : 0); | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment