| 63 | | |
|---|
| 64 | | $this->sfGuardUser = $query->execute()->getFirst(); |
|---|
| 65 | | $this->sfGuardUser->setIsActive(1); |
|---|
| 66 | | $this->sfGuardUser->confirm(); |
|---|
| 67 | | $this->sfGuardUser->save(); |
|---|
| 68 | | |
|---|
| 69 | | $this->forward404Unless($this->sfGuardUser); |
|---|
| 70 | | |
|---|
| 71 | | $rawEmail = $this->sendEmail('sfGuardRegister', 'send_register_complete'); |
|---|
| 72 | | $this->logMessage($rawEmail, 'debug'); |
|---|
| 73 | | |
|---|
| 74 | | $this->setFlash('notice', 'You have successfully confirmed your registration!'); |
|---|
| 75 | | $this->redirect('@sf_guard_register_complete?id='.$this->sfGuardUser->getId()); |
|---|
| 76 | | } |
|---|
| 77 | | |
|---|
| 78 | | // public function executeRegister_complete() |
|---|
| 79 | | // { |
|---|
| 80 | | // |
|---|
| 81 | | // } |
|---|
| 82 | | |
|---|
| 83 | | // public function handleErrorRegister() |
|---|
| 84 | | // { |
|---|
| 85 | | // $this->setFlash('error', 'An error occurred with your registration, please try again!'); |
|---|
| 86 | | // $this->forward('sfGuardRegister', 'index'); |
|---|
| 87 | | // } |
|---|
| 89 | | public function executeSend_confirm_registration() |
|---|
| 90 | | { |
|---|
| 91 | | $this->sfGuardUser = sfGuardUserTable::retrieveByUsernameOrEmailAddress($this->getRequestParameter('user[username]'), false); |
|---|
| 92 | | |
|---|
| 93 | | $mail = new sfMail(); |
|---|
| 94 | | $mail->setContentType('text/html'); |
|---|
| 95 | | $mail->setSender(sfConfig::get('app_outgoing_emails_sender')); |
|---|
| 96 | | $mail->setFrom(sfConfig::get('app_outgoing_emails_from')); |
|---|
| 97 | | $mail->addReplyTo(sfConfig::get('app_outgoing_emails_reply_to')); |
|---|
| 98 | | $mail->addAddress($this->sfGuardUser->getEmailAddress()); |
|---|
| 99 | | $mail->setSubject('Confirm Registration'); |
|---|
| 100 | | |
|---|
| 101 | | $this->mail = $mail; |
|---|
| | 82 | $sfGuardUser = $query->execute()->getFirst(); |
|---|
| | 83 | $sfGuardUser->setIsActive(1); |
|---|
| | 84 | $sfGuardUser->confirm(); |
|---|
| | 85 | $sfGuardUser->save(); |
|---|
| | 86 | |
|---|
| | 87 | $this->forward404Unless($sfGuardUser); |
|---|
| | 88 | |
|---|
| | 89 | $messageParams = array( |
|---|
| | 90 | 'sfGuardUser' => $sfGuardUser, |
|---|
| | 91 | ); |
|---|
| | 92 | $message = $this->getComponent('sfGuardRegister', 'send_complete', $messageParams); |
|---|
| | 93 | |
|---|
| | 94 | $mailParams = array( |
|---|
| | 95 | 'to' => $sfGuardUser->getEmailAddress(), |
|---|
| | 96 | 'subject' => 'Registration Complete', |
|---|
| | 97 | 'message' => $message |
|---|
| | 98 | ); |
|---|
| | 99 | sfGuardExtraMail::send($mailParams); |
|---|
| | 100 | |
|---|
| | 101 | $this->redirect('@sf_guard_register_complete?id='.$sfGuardUser->getId()); |
|---|
| 106 | | $params = array($this->getRequestParameter('key'), $this->getRequestParameter('id')); |
|---|
| 107 | | |
|---|
| 108 | | $query = new Doctrine_Query(); |
|---|
| 109 | | $query->from('sfGuardUser u')->where('u.password = ? AND u.id = ?', $params)->limit(1); |
|---|
| 110 | | |
|---|
| 111 | | $this->sfGuardUser = $query->execute()->getFirst(); |
|---|
| 112 | | |
|---|
| 113 | | $mail = new sfMail(); |
|---|
| 114 | | $mail->setContentType('text/html'); |
|---|
| 115 | | $mail->setSender(sfConfig::get('app_outgoing_emails_sender')); |
|---|
| 116 | | $mail->setFrom(sfConfig::get('app_outgoing_emails_from')); |
|---|
| 117 | | $mail->addReplyTo(sfConfig::get('app_outgoing_emails_reply_to')); |
|---|
| 118 | | $mail->addAddress($this->sfGuardUser->getEmailAddress()); |
|---|
| 119 | | $mail->setSubject('Registration Complete'); |
|---|
| 120 | | |
|---|
| 121 | | $this->mail = $mail; |
|---|