public function actionActivate()
 {
     if (Yii::$app->request->isAjax) {
         if ($code = Yii::$app->request->post()['code']) {
             $initUser = new User();
             $initGlbUser = new GlbUser();
             $glbUser = $initGlbUser->getUser();
             // return var_dump($glbUser->status);
             $user = $initUser->getUser();
             if ($user->status !== User::STATUS_ACTIVE) {
                 if ($code === $user->verification_code) {
                     $glbUser->status = User::STATUS_ACTIVE;
                     $user->status = User::STATUS_ACTIVE;
                     if ($user->save() && $glbUser->save()) {
                         return 'true';
                     }
                 }
             } else {
                 return 'done';
             }
         }
         return 'false';
     }
     return $this->goBack;
 }
Beispiel #2
0
 public function checkEmailExists($email)
 {
     $result = GlbUser::findOne(['email' => $email]);
     if ($result) {
         return true;
     }
     return false;
 }
 public function linkMyData()
 {
     // These guys are the linker
     $glbUser = new GlbUser();
     $user = $glbUser->getUser();
     if ($user === null) {
         return false;
     }
     $this->company_id = $user->company_id;
     Yii::$app->session->set('company_id', $this->company_id);
     // These guys are the linker- END
     return true;
 }