Changeset 29
- Timestamp:
- 12/12/05 12:33:22 (3 years ago)
- Files:
-
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/lib/helper/GlobalHelper.php (modified) (1 diff)
- trunk/frontend/modules/mail (added)
- trunk/frontend/modules/mail/actions (added)
- trunk/frontend/modules/mail/actions/actions.class.php (added)
- trunk/frontend/modules/mail/config (added)
- trunk/frontend/modules/mail/config/.sf (added)
- trunk/frontend/modules/mail/config/mailer.yml (added)
- trunk/frontend/modules/mail/config/module.yml (added)
- trunk/frontend/modules/mail/lib (added)
- trunk/frontend/modules/mail/lib/.sf (added)
- trunk/frontend/modules/mail/templates (added)
- trunk/frontend/modules/mail/templates/sendPasswordSuccess.altbody.php (added)
- trunk/frontend/modules/mail/templates/sendPasswordSuccess.php (added)
- trunk/frontend/modules/mail/validate (added)
- trunk/frontend/modules/mail/validate/.sf (added)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (1 diff)
- trunk/frontend/modules/user/templates/loginSuccess.php (modified) (1 diff)
- trunk/frontend/modules/user/templates/passwordRequestMailSent.php (added)
- trunk/frontend/modules/user/templates/passwordRequestSuccess.php (added)
- trunk/frontend/modules/user/validate/passwordRequest.yml (added)
- trunk/frontend/templates/layout.php (modified) (1 diff)
- trunk/test/frontend/mailActionsTest.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/frontend/config/routing.yml
r27 r29 46 46 param: { module: user, action: new } 47 47 48 user_require_password: 49 url: /password_request 50 param: { module: user, action: passwordRequest } 51 48 52 # login 49 53 login: trunk/frontend/lib/helper/GlobalHelper.php
r27 r29 8 8 function link_to_login($name, $uri = null) 9 9 { 10 use_helper('Javascript'); 11 10 12 if ($uri && sfContext::getInstance()->getUser()->isAuthenticated()) 11 13 { trunk/frontend/modules/user/actions/actions.class.php
r25 r29 83 83 } 84 84 85 public function executePasswordRequest() 86 { 87 if ($this->getRequest()->getMethod() != sfRequest::POST) 88 { 89 // display the form 90 return sfView::SUCCESS; 91 } 92 93 // handle the form submission 94 $c = new Criteria(); 95 $c->add(UserPeer::EMAIL, $this->getRequestParameter('email')); 96 $user = UserPeer::doSelectOne($c); 97 98 // email exists? 99 if ($user) 100 { 101 // set new random password 102 $password = substr(md5(rand(100000, 999999)), 0, 6); 103 $user->setPassword($password); 104 105 $this->getRequest()->setAttribute('password', $password); 106 $this->getRequest()->setAttribute('nickname', $user->getNickname()); 107 108 $raw_email = $this->sendEmail('mail', 'sendPassword'); 109 $this->getLogger()->debug($raw_email); 110 111 // save new password 112 $user->save(); 113 114 return 'MailSent'; 115 } 116 else 117 { 118 $this->getRequest()->setError('email', 'There is no askeet user with this email address. Please try again'); 119 120 return sfView::SUCCESS; 121 } 122 } 123 85 124 public function handleErrorLogin() 125 { 126 return sfView::SUCCESS; 127 } 128 129 public function handleErrorPasswordRequest() 86 130 { 87 131 return sfView::SUCCESS; trunk/frontend/modules/user/templates/loginSuccess.php
r16 r29 20 20 <?php echo input_hidden_tag('referer', $request->getAttribute('referer')) ?> 21 21 <?php echo submit_tag('sign in') ?> 22 <?php echo link_to('Forgot your password?', '@user_require_password') ?> 22 23 23 24 </form> trunk/frontend/templates/layout.php
r27 r29 45 45 nickname: <?php echo input_tag('nickname') ?><br /> 46 46 password: <?php echo input_password_tag('password') ?><br /> 47 <? =input_hidden_tag('referer', $params->get('referer') ? $params->get('referer') : $request->getUri()) ?>47 <?php echo input_hidden_tag('referer', $params->get('referer') ? $params->get('referer') : $request->getUri()) ?> 48 48 <?php echo submit_tag('login') ?> 49 <?php echo link_to('Forgot your password?','@user_require_password') ?> 49 50 </form> 50 51 </div>
