Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
did you find something on upwork? So there you still need to cover the application with tests.
LoginForm.php
/**
* Logs in a user using the provided username and password.
* @return boolean whether the user is logged in successfully
*/
public function login()
{
return Yii::$app->user->login($this->getUser(Yii::$app->request->userIP));
}
/**
* Finds user by
*
* @return User|null
*/
public function getUser()
{
if ($this->_user === false) {
$this->_user = User::findByIp(Yii::$app->request->userIP);
}
return $this->_user;
}
public static function findByIp($ip)
{
return new static(['id'=>$ip ]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question