customer available events improvements

This commit is contained in:
Roland Schneider
2021-09-10 23:30:13 +02:00
parent 2bf9985928
commit 18cd8312b5
15 changed files with 125 additions and 179 deletions

View File

@@ -2,13 +2,9 @@
namespace customerapi\controllers;
use Yii;
use common\models\LoginForm;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\User;
use common\components\Helper;
use common\models\Log;
/**
* Site controller
@@ -68,43 +64,6 @@ class SiteController extends Controller
return $this->render('index');
}
/**
* Logs in a user.
*
* @return mixed
*/
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
$geoip = Helper::getGeoIp();
$message = "";
$user = User::findOne(\Yii::$app->user->id);
if ( isset($geoip)){
$ip = isset( $geoip->ip ) ? $geoip->ip : "";
$city = isset( $geoip->city ) ? $geoip->city : "";
$message = "Bejelentkezés: " .$user->username. " Ip cím:". $ip . " Város: " . $city;
}
Log::log([
'type' =>Log::$TYPE_LOGIN,
'message' => $message
]);
return $this->redirect(['account/select']);
} else {
return $this->render('login', ['model' => $model,]);
}
}
/**
* Logs out the current user.
*