/** * Displays the login page */ public function actionLogin() { if (User::model()->findAll() == null) { $this->redirect(Yii::app()->createAbsoluteUrl('install/user')); Yii::app()->end(); } $model = new FormLogin(); $this->layout = '//layouts/clean'; // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['FormLogin'])) { $model->attributes = $_POST['FormLogin']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { $this->redirect(Yii::app()->user->returnUrl); } } if (isset($_POST['login_id'])) { $model->id = $_POST['login_id']; $model->hash = $_POST['login_hash']; //$model->login_company = $_POST['login_company']; // validate user input and redirect to the previous page if valid if ($model->apiLogin()) { $this->redirect(Yii::app()->user->returnUrl); } } // display the login form $this->render('login', array('model' => $model)); }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { /*ELECCION DE LOCAL*/ $session = Yii::app()->getSession(); $tipo_user = $session['_tipo']; $local_user = $session['_local']; if ($tipo_user == 'EMPLEADO' and !$local_user) { $this->redirect(array('user/elegir')); } $this->redirect(Yii::app()->user->returnUrl); } } // display the login form $this->render('ingreso', array('model' => $model)); }
protected function showGeneralForm() { $model = new SettingGeneralForm(); settings()->deleteCache(); //Set Value for the Settings $model->site_name = Yii::app()->settings->get('general', 'site_name'); $model->site_title = Yii::app()->settings->get('general', 'site_title'); $model->site_description = Yii::app()->settings->get('general', 'site_description'); $model->slogan = Yii::app()->settings->get('general', 'slogan'); $model->homepage = Yii::app()->settings->get('general', 'homepage'); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'settings-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['SettingGeneralForm'])) { $model->attributes = $_POST['SettingGeneralForm']; if ($model->validate()) { settings()->deleteCache(); foreach ($model->attributes as $key => $value) { Yii::app()->settings->set('general', $key, $value); } user()->setFlash('success', t('General Settings Updated Successfully!')); } } $this->render('cmswidgets.views.settings.settings_general_widget', array('model' => $model)); }
/** * Performs the AJAX validation. * * @param CModel the model to be validated * * @return void */ protected function performAjaxValidation(News $model) { if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'news-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
protected function performAjaxValidation($model) { if (isset($_POST['ajax'])) { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); $usuario = ""; $contrasenia = ""; $error = ""; // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; //Almacenar datos para ver que esta enviando $usuario = $model->username; $contrasenia = $model->password; //$error=$model->login(); // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { $this->redirect(Yii::app()->user->returnUrl); } } // display the login form $this->render('login', array('model' => $model, 'usuario' => $usuario, 'error' => $error)); }
/** * Performs the AJAX validation. * @param CModel the model to be validated */ public function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'artist-area-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Performs the AJAX validation. * @param CModel the model to be validated */ protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'finance-fee-particulars-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Displays the login page */ public function actionLogin() { if (!Helper::BrowserIsChrome()) { $this->renderPartial('download'); Yii::app()->end(); } $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { if (Yii::app()->user->checkAccess("playtocrmdash") && !Yii::app()->user->checkAccess("cgtz_adminstrator")) { $this->redirect($this->createUrl("/crm/dashboard")); } else { $this->redirect($this->createUrl("/site/index")); } } } // display the login form $this->renderPartial('login', array('model' => $model)); }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // var_dump($_POST); // die; // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { // var_dump($_POST); // die; $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { // Yii::app()->user->returnUrl = Yii::app()->request->urlReferrer; // echo Yii::app()->request->urlReferrer; // die; // $this->redirect(Yii::app()->user->returnUrl); $record = Users::model()->findByAttributes(array('username' => $_POST['LoginForm']['username'])); // echo "ssss"; // var_dump($record); // die; Yii::app()->session['uid'] = $record['id']; Yii::app()->session['username'] = $record['username']; $this->redirect('/index.php?r=posts/index'); } } // display the login form $this->render('login', array('model' => $model)); }
/** * Displays the login page */ public function actionLogin() { $this->layout = '//layouts/login'; if (@Yii::app()->user->id) { $this->redirect(Yii::app()->homeUrl); } $model = new LoginFormAdmin(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginFormAdmin'])) { $model->attributes = $_POST['LoginFormAdmin']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { $audit = new AuditTrail(); $audit->user_id = Yii::app()->user->id; $audit->login_time = new CDbExpression('NOW()'); $audit->user_type = 1; $audit->save(); Yii::app()->user->setFlash('success', 'Welcome in the <strong>' . CHtml::encode(Yii::app()->name) . ' Admin Panel</strong>. Don\'t forget to <strong>Logout</strong> when finish!'); $this->redirect(Yii::app()->user->returnUrl); } } // display the login form $this->render('login', array('model' => $model)); }
public function performAjaxValidation(Package $model) { if (Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getPost('ajax') === 'package-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
protected function performAjaxValidation($model, $id = 'comments-form') { if (isset($_POST['ajax']) && $_POST['ajax'] === $id) { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Displays the login page */ public function actionLogin() { if (!defined('CRYPT_BLOWFISH') || !CRYPT_BLOWFISH) { throw new CHttpException(500, "This application requires that PHP was compiled with Blowfish support for crypt()."); } $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { switch (Yii::app()->user->model->papel) { case 'T': $this->redirect(array('aeroporto/admin')); break; case 'E': $this->redirect(array('aviao/admin')); break; case 'P': $this->redirect(array('voo/voosPiloto')); break; default: $this->redirect(Yii::app()->user->returnUrl); break; } } } // display the login form $this->render('login', array('model' => $model)); }
public function actionSconfig() { if (Yii::app()->request->isPostRequest) { $_model = new Sconfig(); $_model->attributes = $_POST['Sconfig']; $model = Sconfig::model()->find(); if (strlen(CActiveForm::validate($_model)) == 2) { if (!$model) { $model = new Sconfig(); $model->attributes = $_POST['Sconfig']; $model->save(); } else { Sconfig::model()->updateAll($_POST['Sconfig']); } $str = 'Data saved suc On ' . date("Y-m-d H:i:s"); Yii::app()->user->setFlash('success', $str); $sconfig = Sconfig::model()->find(); } else { $sconfig = $_model; $str = 'Data saved fail! On ' . date("Y-m-d H:i:s"); Yii::app()->user->setFlash('fail', $str); } } else { $sconfig = Sconfig::model()->find(); if (!$sconfig) { $sconfig = new Sconfig(); } } $this->render('_sconfig', array('sconfig' => $sconfig)); }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; $criteria = new EMongoCriteria(); $criteria->login = $model->username; $criteria->password = $model->password; $user = User::model()->find($criteria); // validate user input and redirect to the previous page if valid if ($model->validate()) { if (count($user->profil) == 0) { Yii::app()->user->setFlash('error', Yii::t('common', 'contactAdministrator')); } elseif ($model->login()) { $this->redirect(array('site/index')); } } else { Yii::app()->user->setFlash('error', Yii::t('common', 'incorrectLoginPassword')); } } // display the login form $this->render('login', array('model' => $model)); }
protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'product-attribute-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { // echo $a."s"; die(); $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate()) { if ($model->login()) { $idUsr = Yii::app()->user->getId(); $criteria = new CDbCriteria(); $profile = TransaksiRegistrasi::model()->get_data_profile($idUsr); if ($profile['STATUS_FIRST_LOGIN'] == 0) { $this->redirect(Yii::app()->user->returnUrl . 'profile/changePass'); } else { $this->redirect(Yii::app()->user->returnUrl . 'timeline'); } } } } // display the login form $this->render('login', array('model' => $model)); }
public function actionRecover() { $model = new RecoverForm(); if (isset($_POST['ajax']) && $_POST['ajax'] === 'recover-form') { echo CActiveForm::validate($model); Yii::app()->end(); } if (isset($_POST['RecoverForm'])) { $model->attributes = $_POST['RecoverForm']; if ($model->validate()) { $user = Users::model()->findByAttributes(array("email" => $model->email)); $password = md5(uniqid()); $user->hash = md5($user->email . uniqid()); $user->userkey = sha1($user->email . uniqid()); $user->password = md5($password . $user->hash); if ($user->save()) { $message = $this->renderPartial('/messages/recover', array("username" => $user->username, "password" => $password), true); MyPhpMailer::send($user->email, "Восстановление пароля на FermionAm.ru", $message); $this->redirect(array('site/index')); } else { print CHtml::errorSummary($user); Yii::app()->end(); } } else { print CHtml::errorSummary($model); Yii::app()->end(); } } $this->render('recover', array('model' => $model)); }
public function actionLogin() { $returnUrl = Yii::app()->user->__returnUrl; if (!Yii::app()->user->getIsGuest()) { //$this->redirect(array('/admin/')); $this->rediretParentUrl($returnUrl); } $model = new LoginForm(); $this->layout = false; $this->pageTitle = Yii::t('admin', 'admin login') . ' - ' . $this->setting_base['site_name']; // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { $this->message('success', Yii::t('common', 'Login Success'), $returnUrl, 2); } } $this->render('login', array('model' => $model)); }
public function actionIndex() { if (isset(Yii::app()->user->adminLogin) == TRUE) { $this->redirect(array('product/admin')); } /* panggil model AdminLoginForm * dan di tampung oleh $model */ $model = new AdminLoginForm(); // jika ajax maka divalidasi dengan ajax if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { /* tampilkan hasil validasi form */ echo CActiveForm::validate($model); /* end/exit/die */ Yii::app()->end(); } // ambil data yang diinput oleh user if (isset($_POST['AdminLoginForm'])) { $model->attributes = $_POST['AdminLoginForm']; /* validaasi data yang diinput oleh user dan * jika valid maka ... */ if ($model->validate() && $model->login()) { /* redirect ke halaman yang diinginkan * (dalam hal ini kita direct ke halaman product/admin) * */ $this->redirect(array('product/admin')); } } // tampilkan login form $this->render('index', array('model' => $model)); }
/** * Displays the login page */ public function actionLogin() { if (!isset($_SESSION['chance'])) { $_SESSION['chance'] = 3; } $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if (isset($_SESSION['pin']) && $_SESSION['pin'] && $model->pin != $_SESSION['pin']) { $_SESSION['chance'] -= 1; echo '<script>'; echo 'alert("Pin salah' . ($_SESSION['chance'] > 0 ? '\\n' . $_SESSION['chance'] . ' kali lagi' : '') . '");'; if ($_SESSION['chance'] < 1) { echo 'location.href="../";'; } echo '</script>'; } else { if ($model->validate() && $model->login()) { $this->redirect(Yii::app()->user->returnUrl); } } } // display the login form $this->render('login', array('model' => $model)); }
/** * Displays the login page */ public function actionLogin($sh = '', $t = '') { $this->model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($this->model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $this->model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($this->model->validate() && $this->model->login()) { //Assign the subject to the new user if he/she registered after adding a subject if ($sh and $t) { //Allow asignment only within 15 minutes since subject added if (SiteLibrary::utc_time() - $t < 900) { Subject::model()->updateAll(array('user_id' => Yii::app()->user->id), 'time_submitted=:time_submitted AND hash=:hash', array(':time_submitted' => $t, ':hash' => $sh)); } $this->redirect(array('mysub/' . Yii::app()->user->name)); } else { $this->redirect(Yii::app()->user->returnUrl); } } } // display the login form $this->render('login', array('model' => $this->model)); }
public function run() { // Создать модель и указать ей, что используется сценарий регистрации $model = new RegistrationForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'RegistrationForm') { //echo CActiveForm::validate($model); $error = CActiveForm::validate($model); if ($error != '[]') { echo $error; } Yii::app()->end(); } // Если пришли данные для сохранения if (isset($_POST['RegistrationForm'])) { // Безопасное присваивание значений атрибутам $model->attributes = $_POST['RegistrationForm']; // Проверка данных if ($model->validate() && $model->signUp()) { echo CJSON::encode(array('status' => 'success')); Yii::app()->end(); } else { $error = CActiveForm::validate($model); if ($error != '[]') { echo $error; } Yii::app()->end(); } } // вивести форму //$this->controller->redirect(Yii::app()->user->returnUrl); //$this->renderPartial('registration', array('model'=>$model)); }
protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'ServicePartsEdit-form' && $_POST['ajax'] === 'ServiceRecordEdit-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 't-account-report-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { if (end(explode("/", Yii::app()->user->returnUrl)) == 'index.php') { $this->redirect('negociosavenda/'); } else { $this->redirect(Yii::app()->user->returnUrl); } } else { Yii::app()->user->setFlash('#usr_error', true); $this->redirect(array('/negociosavenda')); } } // display the login form //$this->render('/layouts/comuns/_loginForm',array('model'=>$model)); }
protected function renderContent() { if (!user()->isGuest) { $model = new UserChangePassForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'userchangepass-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if (isset($_POST['UserChangePassForm'])) { $model->attributes = $_POST['UserChangePassForm']; // validate user input password if ($model->validate()) { $u = User::model()->findbyPk(user()->id); if ($u !== null) { $u->password = PassHash::hash($model->new_password_1); if ($u->save()) { user()->setFlash('success', t('cms', 'Changed Password Successfully!')); } } $model = new UserChangePassForm(); } } $this->render('cmswidgets.views.user.user_change_pass_widget', array('model' => $model)); } else { Yii::app()->request->redirect(user()->returnUrl); } }
protected function performAjaxValidation($model) { if (isset($_POST['ajax']) && $_POST['ajax'] === 'create-category-form') { echo CActiveForm::validate($model); Yii::app()->end(); } }
/** * A universal login function * @return mixed -true if login is successful * -false if user already logged in * -string the rendered view page in text */ protected function _login() { if (Yii::app()->user->isGuest) { $model = new LoginForm(); // if it is ajax validation request if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { //echo CActiveForm::validate($model); //Yii::app()->end(); $errors = CActiveForm::validate($model); if ($errors != '[]') { echo $errors; Yii::app()->end(); } } // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->login()) { echo "user is there"; return true; } } //use the login view in the common folder return $this->render('application.modules.account.views.common.login', array('model' => $model), true); } else { return false; } }