openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

ProfileConfirmmailAction.class.php (884B)


      1 <?php
      2 namespace cms\action\profile;
      3 use cms\action\Method;
      4 use cms\action\ProfileAction;
      5 use language\Messages;
      6 use util\exception\ValidationException;
      7 use util\Session;
      8 
      9 class ProfileConfirmmailAction extends ProfileAction implements Method {
     10     public function view() {
     11     }
     12     public function post() {
     13 		$sessionCode       = Session::get( Session::KEY_MAIL_CHANGE_CODE );
     14 		$newMail           = Session::get( Session::KEY_MAIL_CHANGE_MAIL );
     15 		$inputRegisterCode = $this->request->getText('code');
     16 		
     17 		if	( $sessionCode == $inputRegisterCode )
     18 		{
     19 			// Best�tigungscode stimmt �berein.
     20 			// E-Mail-Adresse �ndern.	
     21 			$this->user->mail = $newMail;
     22 			$this->user->persist();
     23 			
     24 			$this->addNoticeFor( $this->user,Messages::SAVED );
     25 		}
     26 		else
     27 		{
     28 			// Validation code does not match
     29 			throw new ValidationException('code',Messages::CODE_NOT_MATCH );
     30 		}
     31 		
     32     }
     33 }