File modules/cms/action/login/LoginRegisterAction.class.php

Last commit: Wed Oct 27 02:27:59 2021 +0200	Jan Dankert	Refactoring: Splitted the mail client into a.) sendmail and b.) smtp.
1 <?php 2 namespace cms\action\login; 3 use cms\action\LoginAction; 4 use cms\action\Method; 5 use cms\action\RequestParams; 6 use cms\model\User; 7 use language\Messages; 8 use logger\Logger; 9 use util\exception\ValidationException; 10 use util\mail\Mail; 11 use util\Session; 12 use util\text\TextMessage; 13 14 15 class LoginRegisterAction extends LoginAction implements Method { 16 public function view() { 17 18 } 19 20 public function post() { 21 22 $email_address = $this->request->getValidMail('mail'); 23 24 Session::set( Session::KEY_REGISTER_MAIL,$email_address ); 25 26 srand ((double)microtime()*1000003); 27 $registerCode = rand(); 28 29 Session::set( Session::KEY_REGISTER_CODE,$registerCode ); 30 31 32 // E-Mail and die eingegebene Adresse verschicken 33 $mail = new Mail($email_address, Messages::MAIL_SUBJECT_REGISTER_COMMIT_CODE,Messages::MAIL_TEXT_REGISTER_COMMIT_CODE); 34 $mail->setVar('code',$registerCode); // Registrierungscode als Text-Variable 35 36 try { 37 $mail->send(); 38 $this->addNoticeFor( new User(), Messages::MAIL_SENT); 39 } catch( \Exception $e ) { 40 Logger::warn( new \Exception(TextMessage::create('Mail could not be sent for unregistered user with adress ${0}', [$email_address]), $e) ); 41 $this->addErrorFor( new User(),Messages::MAIL_NOT_SENT); 42 } 43 } 44 }
Download modules/cms/action/login/LoginRegisterAction.class.php
History Wed, 27 Oct 2021 02:27:59 +0200 Jan Dankert Refactoring: Splitted the mail client into a.) sendmail and b.) smtp. Thu, 11 Mar 2021 00:01:47 +0100 Jan Dankert Refactoring: Cleaned the Request params. Wed, 10 Mar 2021 23:51:22 +0100 Jan Dankert Refactoring: Cleaned the Request params. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Thu, 19 Nov 2020 16:05:15 +0100 Jan Dankert Refactoring: Better exception handling in class Mail; multiple CC and BCC receivers. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.