當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserDAO::updateUserPassword方法代碼示例

本文整理匯總了PHP中UserDAO::updateUserPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserDAO::updateUserPassword方法的具體用法?PHP UserDAO::updateUserPassword怎麽用?PHP UserDAO::updateUserPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserDAO的用法示例。


在下文中一共展示了UserDAO::updateUserPassword方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: forgotPasswordModel

 public function forgotPasswordModel($forgotPasswordForm)
 {
     $formObjRaw = new FormDTO(FORGOT_PWD_FORM, $forgotPasswordForm);
     $responseDTO = new ResponseDTO(FORGOT_PWD_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(FORGOT_PWD_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $userDAO = new UserDAO();
             $userDTO = $userDAO->getUserByEmail($formDataObj[FORGOT_PWD_FORM . EMAIL]);
             if (is_null($userDTO)) {
                 $responseDTO->setErrField(ERROR_RESPONSE, "Nessun user presente con questa mail");
             } else {
                 $newPassword = PasswordUtils::createRandomicPassword();
                 $userDTO->setPassword($newPassword);
                 $resultMail = DataModelUtils::sendMail($userDTO, FORGOT_PWD_FORM);
                 $hashedPwd = PasswordUtils::getPassword($newPassword);
                 $userDTO->setPassword($hashedPwd);
                 $result = $userDAO->updateUserPassword($userDTO);
                 if ($result != 1) {
                     $responseDTO->setErrField(ERROR_RESPONSE, "Problema nel cambio della password");
                 } else {
                     $responseDTO->setResponseSucc("Verra mandata una mail con una nuova password all'indirizzo " . $userDTO->getEmail());
                 }
             }
         } else {
             if (array_key_exists(EMAIL, $validationError)) {
                 $responseDTO->setErrField(EMAIL, $validationError[EMAIL]);
             }
             SessionUtils::setFormValue($formDataObj);
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
開發者ID:sbadi,項目名稱:shareatrip,代碼行數:39,代碼來源:ForgotPwd_model.php

示例2: changeUserPwdModel

 function changeUserPwdModel($pwdForm)
 {
     $formObjRaw = new FormDTO(CHANGE_PWD_FORM, $pwdForm);
     $responseDTO = new ResponseDTO(CHANGE_PWD_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(CHANGE_PWD_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $userLogged = SessionUtils::getUserLogged();
             $hashedPwd = PasswordUtils::getPassword($formDataObj[CHANGE_PWD_FORM . PASSWORD]);
             $userDTO = new UserDTO($userLogged->getUserId(), NULL, $hashedPwd, NULL, NULL, NULL, NULL, NULL);
             $userDAO = new UserDAO();
             $userLoggedDTO = $userDAO->checkPassword($userDTO);
             if (is_null($userLoggedDTO)) {
                 $responseDTO->setResponseSucc("Questa password non esiste");
                 return $responseDTO;
             }
             $hashedPwd = PasswordUtils::getPassword($formDataObj[CHANGE_PWD_FORM . NEW_PASSWORD]);
             $userDTO->setPassword($hashedPwd);
             $userPwdUpdated = $userDAO->updateUserPassword($userDTO);
             return $userDTO;
         } else {
             if (array_key_exists(PASSWORD, $validationError)) {
                 $responseDTO->setErrField(PASSWORD, $validationError[PASSWORD]);
             }
             if (array_key_exists(NEW_PASSWORD, $validationError)) {
                 $responseDTO->setErrField(NEW_PASSWORD, $validationError[NEW_PASSWORD]);
             }
             if (array_key_exists(CONFIRM_PASSWORD, $validationError)) {
                 $responseDTO->setErrField(CONFIRM_PASSWORD, $validationError[CONFIRM_PASSWORD]);
             }
             //                var_dump($validationError);
             //                var_dump($responseDTO);die;
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
開發者ID:sbadi,項目名稱:shareatrip,代碼行數:44,代碼來源:ProfileSettings_model.php


注:本文中的UserDAO::updateUserPassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。