customer available events improvements
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user