コード例 #1
0
ファイル: LoginAction.php プロジェクト: CHILMEX/amocasion
 protected function returnSuccess()
 {
     if ($this->isAjax()) {
         echo CJSON::encode(array('result' => 0, 'message' => Yii::t('user', 'Login successful')));
         Yii::app()->end();
     } else {
         Flashes::addInfoFlash(Yii::t('user', 'Login successful'));
         $this->getController()->redirect(Yii::app()->user->returnUrl);
     }
 }
コード例 #2
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  */
 public function actionDelete()
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         if (LocationService::loadModel()->delete()) {
             Flashes::addInfoFlash(Yii::t('amo', 'Location deleted'));
         } else {
             Flashes::addErrorFlash(Yii::t('amo', 'Could not delete the location.') . '  ' . Yii::t('amo', 'Please, try again later.'));
         }
         $this->redirect(array('index'));
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
コード例 #3
0
ファイル: ForgotAction.php プロジェクト: CHILMEX/amocasion
 protected function returnSuccess($user)
 {
     $newPassword = UserService::resetPassword($user);
     $message = $newPassword ? "" : Yii::t('user', 'An email was sent with a new password');
     if ($this->isAjax()) {
         echo CJSON::encode(array('result' => $newPassword ? 0 : -1, 'message' => $message));
         Yii::app()->end();
     } else {
         if ($emailSent) {
             Flashes::addInfoFlash($message);
             $this->getController()->redirect(Yii::app()->user->returnUrl);
         }
     }
 }
コード例 #4
0
ファイル: RegisterAction.php プロジェクト: CHILMEX/amocasion
 protected function returnSuccess($user)
 {
     $registrationSuccessful = UserService::register($user);
     $message = $registrationSuccessful ? "" : Yii::t('user', 'An email was sent with the registration password');
     if ($this->isAjax()) {
         echo CJSON::encode(array('result' => $registrationSuccessful ? 0 : -1, 'message' => $message));
         Yii::app()->end();
     } else {
         if ($registrationSuccessful) {
             Flashes::addInfoFlash($message);
             $this->getController()->redirect(Yii::app()->user->returnUrl);
         }
     }
 }
コード例 #5
0
ファイル: UserController.php プロジェクト: CHILMEX/amocasion
 public function actionLogout()
 {
     Yii::app()->user->logout();
     Flashes::addInfoFlash(Yii::t('amo', 'You have logged out. Thank you for visiting us!'));
     $this->redirect(Yii::app()->homeUrl);
 }
コード例 #6
0
 /** Deletes a particular model. If deletion is successful, the browser will be redirected to the 'list' page. */
 public function actionDelete()
 {
     $model = $this->loadVehicle();
     if (Yii::app()->user->checkAccess('editOwnVehicle', array('vehicle' => $model), false)) {
         if (Yii::app()->request->isPostRequest) {
             // we only allow deletion via POST request
             if ($model->delete()) {
                 Flashes::addInfoFlash(Yii::t('amo', 'Vehicle deleted successfully'));
             } else {
                 Flashes::addErrorFlash(Yii::t('amo', 'Could not delete the vehicle.') . '  ' . Yii::t('amo', 'Please, try again later.'));
             }
             $this->redirect(array('list'));
         } else {
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     } else {
         $this->accessDenied(Yii::app()->user);
     }
 }