当前位置: 首页>>代码示例>>PHP>>正文


PHP User::getByEmail方法代码示例

本文整理汇总了PHP中Model\User::getByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getByEmail方法的具体用法?PHP User::getByEmail怎么用?PHP User::getByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model\User的用法示例。


在下文中一共展示了User::getByEmail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetByEmail

 public function testGetByEmail()
 {
     $u = new User($this->container);
     $this->assertNotFalse($u->create(array('username' => 'user1', 'password' => '123456', 'email' => 'user1@localhost')));
     $this->assertNotFalse($u->create(array('username' => 'user2', 'password' => '123456', 'email' => '')));
     $this->assertNotEmpty($u->getByEmail('user1@localhost'));
     $this->assertEmpty($u->getByEmail(''));
 }
开发者ID:NextGenIntelligence,项目名称:kanboard,代码行数:8,代码来源:UserTest.php

示例2: resetAction

 public function resetAction()
 {
     //Extracting RedirectURL
     $redirectUrl = $this->getBag->get('redirect');
     //base64 encoded
     if (strlen($redirectUrl) > 0) {
         $redirectUrl = base64_decode($redirectUrl);
     } elseif ($this->getBag->has('returnurl') && $this->getBag->get('returnurl') != '') {
         $redirectUrl = urldecode($this->getBag->get('returnurl'));
     } else {
         $redirectUrl = $this->registry->conf['rooturl'];
     }
     $error = $warning = $formData = array();
     $email = $this->getBag->get('email');
     $activatedCode = $this->getBag->get('code');
     //Found user by email
     $myUser = \Model\User::getByEmail(urldecode($email));
     if ($myUser->id > 0) {
         if ($myUser->activatedcode != $activatedCode && false) {
             $this->notfound();
         } else {
             if ($this->postBag->has('fsubmit')) {
                 $formData = $this->postBag->all();
                 if ($formData['fpassword'] != $formData['fpassword2']) {
                     $error[] = 'Passwords are not matched.';
                 } else {
                     if (strlen($formData['fpassword']) < 6) {
                         $error[] = 'Password is at least 6 characters.';
                     } else {
                         $myUser->newpass = $this->postBag->get('fpassword');
                         $myUser->activatedcode = '';
                         if ($myUser->updateData()) {
                             $success[] = 'Your password had been saved.';
                             $successUrl = $this->registry->conf['rooturl'] . 'login?from=forgotpass&email=' . $myUser->email . '&redirect=' . base64_encode($redirectUrl);
                             $this->doRedirect($successUrl);
                         } else {
                             $error[] = 'Error while changing your password';
                         }
                     }
                 }
                 //end validate form
             }
             //end submit
             if (empty($success)) {
                 $this->registry->smarty->assign(array('formData' => $formData, 'myUser' => $myUser, 'error' => $error, 'warning' => $warning, 'redirectUrlEncode' => base64_encode($redirectUrl)));
                 $contents = $this->registry->smarty->display($this->registry->smartyController . 'reset.tpl');
                 $this->registry->response->setContent($contents);
             }
         }
     } else {
         $this->notfound();
     }
 }
开发者ID:tuyenv,项目名称:litpi-framework-3,代码行数:53,代码来源:ForgotPass.php

示例3: indexAction

 public function indexAction()
 {
     $error = $warning = $formData = array();
     $redirectUrl = $this->registry->request->query->get('redirect');
     //base64 encoded
     $isLoginSuccess = false;
     if ($this->registry->request->request->has('fsubmit')) {
         $formData = array_merge($formData, $this->registry->request->request->all());
         $myUser = \Model\User::getByEmail($formData['femail']);
         if ($myUser->id > 0 && $myUser->password == \Litpi\ViephpHashing::hash($formData['fpassword'])) {
             $isLoginSuccess = true;
             $redirectUrl = $this->doLogin($myUser->id, $formData['fpassword'], $redirectUrl);
             $this->doRedirect($redirectUrl);
         } else {
             $error[] = $this->registry->lang['controller']['errAccountInvalid'];
         }
     }
     if (!$isLoginSuccess) {
         $this->registry->smarty->assign(array('formData' => $formData, 'error' => $error, 'redirectUrl' => $redirectUrl));
         $contents = $this->registry->smarty->fetch($this->registry->smartyController . 'index.tpl');
         $this->registry->response->setContent($contents);
     }
 }
开发者ID:tuyenv,项目名称:litpi-framework-3,代码行数:23,代码来源:Login.php

示例4: addActionValidator

 private function addActionValidator($formData, &$error)
 {
     $pass = true;
     if ($formData['fgroupid'] == 0) {
         $error[] = $this->registry->lang['controller']['errGroupInvalid'];
         $pass = false;
     }
     //kiem tra email co dung dinh dang hay khong    :validateEmail
     if (!Helper::validateEmail($formData['femail'])) {
         $error[] = $this->registry->lang['controller']['errEmailInvalid'];
         $pass = false;
     } else {
         //kiem tra co trung email hay khong
         if (\Model\User::getByEmail($formData['femail'])->id > 0) {
             $error[] = $this->registry->lang['controller']['errEmailExisted'];
             $pass = false;
         }
     }
     //kiem tra password
     if ($formData['fpassword'] == '') {
         $error[] = $this->registry->lang['controller']['errPasswordRequired'];
         $pass = false;
     } elseif ($formData['fpassword'] != $formData['fpassword2']) {
         //nhap lai password khong dung nhu password dau
         $error[] = $this->registry->lang['controller']['errPasswordRetype'];
         $pass = false;
     }
     if ($formData['ffullname'] == '') {
         $error[] = $this->registry->lang['controller']['errFullnameRequired'];
         $pass = false;
     }
     return $pass;
 }
开发者ID:tuyenv,项目名称:litpi-framework-3,代码行数:33,代码来源:User.php


注:本文中的Model\User::getByEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。