Merge pull request #2446 from Theill11/update-apps
Minor updates to apps
This commit is contained in:
commit
1d58a83d8e
@ -55,11 +55,11 @@ class SiteController extends Controller
|
||||
public function actionLogin()
|
||||
{
|
||||
if (!\Yii::$app->user->isGuest) {
|
||||
$this->goHome();
|
||||
return $this->goHome();
|
||||
}
|
||||
|
||||
$model = new LoginForm();
|
||||
if ($model->load($_POST) && $model->login()) {
|
||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||
return $this->goBack();
|
||||
} else {
|
||||
return $this->render('login', [
|
||||
@ -76,8 +76,8 @@ class SiteController extends Controller
|
||||
|
||||
public function actionContact()
|
||||
{
|
||||
$model = new ContactForm;
|
||||
if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
|
||||
$model = new ContactForm();
|
||||
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
|
||||
Yii::$app->session->setFlash('contactFormSubmitted');
|
||||
return $this->refresh();
|
||||
} else {
|
||||
|
@ -24,11 +24,20 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function findIdentity($id)
|
||||
{
|
||||
return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds user by username
|
||||
*
|
||||
* @param string $username
|
||||
* @return static|null
|
||||
*/
|
||||
public static function findByUsername($username)
|
||||
{
|
||||
foreach (self::$users as $user) {
|
||||
@ -39,21 +48,36 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getAuthKey()
|
||||
{
|
||||
return $this->authKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function validateAuthKey($authKey)
|
||||
{
|
||||
return $this->authKey === $authKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates password
|
||||
*
|
||||
* @param string $password password to validate
|
||||
* @return bool if password provided is valid for current user
|
||||
*/
|
||||
public function validatePassword($password)
|
||||
{
|
||||
return $this->password === $password;
|
||||
|
Loading…
Reference in New Issue
Block a user