openrat-cms

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

commit 52e34bcc60fda27c46dfecc9946f82b0fe2c2e34
parent f962edd9e7c72ba3e5e4aa6a01ae3215b4f02034
Author: dankert <devnull@localhost>
Date:   Sat, 17 Nov 2007 17:53:48 +0100

Verbessertes Fehlerhandling bei ?nderung der E-Mail-Adresse.

Diffstat:
actionClasses/ProfileAction.class.php | 62+++++++++++++++++++++++++++++++++++++++++++++++++-------------
actionClasses/ProfileAction.ini.php | 5++++-
2 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/actionClasses/ProfileAction.class.php b/actionClasses/ProfileAction.class.php @@ -72,9 +72,9 @@ class ProfileAction extends Action } - - function confirmmail() - { + + function mailcode() + { srand ((double)microtime()*1000003); $code = rand(); $newMail = $this->getRequestVar('mail'); @@ -83,21 +83,35 @@ class ProfileAction extends Action { // Bestätigungscode stimmt nicht. $this->addValidationError('mail'); - $this->callSubAction('mail'); + return; } else { - Session::set('mailChangeCode',$code ); - Session::set('mailChangeMail',$newMail); + Session::set('mailChangeCode',$code ); + Session::set('mailChangeMail',$newMail); // E-Mail an die neue Adresse senden. $mail = new Mail( $newMail,'mail_change_code' ); $mail->setVar('code',$code ); $mail->setVar('name',$this->user->getName()); - $mail->send(); - - $this->addNotice('user',$newUser->name,'mail_sent','ok'); // Meldung - } + + if ( $mail->send() ) + { + $this->addNotice('user',$this->user->name,'mail_sent',OR_NOTICE_OK); // Meldung + } + else + { + $this->addNotice('user',$this->user->name,'mail_not_sent',OR_NOTICE_ERROR,array(),$mail->error); // Meldung + $this->callSubAction('mail'); + return; + } + } + } + + + + function confirmmail() + { } @@ -115,12 +129,12 @@ class ProfileAction extends Action $this->user->mail = $newMail; $this->user->save(); - $this->addNotice('user',$newUser->name,'user_saved','ok'); + $this->addNotice('user',$this->user->name,'SAVED',OR_NOTICE_OK); } else { // Bestätigungscode stimmt nicht. - $this->addValidationError('code','mailcode_not_match'); + $this->addValidationError('code','code_not_match'); $this->callSubAction('confirmmail'); } @@ -170,5 +184,27 @@ class ProfileAction extends Action function groups() { $this->setTemplateVar( 'groups',$this->user->getGroups() ); - } + } + + + + /** + * @param String $name Menüpunkt + * @return boolean + */ + function checkMenu( $name ) + { + global $conf; + + switch( $name ) + { + case 'pwchange': + return @$conf['security']['auth']['type'] == 'database' + && !@$conf['security']['auth']['userdn']; + + default: + return true; + } + } + } \ No newline at end of file diff --git a/actionClasses/ProfileAction.ini.php b/actionClasses/ProfileAction.ini.php @@ -14,9 +14,12 @@ target=savepw menu=edit [mail] -target=confirmmail +target=mailcode menu=edit +[mailcode] +goto=confirmmail + [confirmmail] target=savemail menu=edit