OnetimeloginConfirmationHandler Class Reference
[Usermanagement]
Confirm onetime login (lost password). More...
Inheritance diagram for
OnetimeloginConfirmationHandler:
Protected Member Functions |
|
do_confirm ($confirmation, $success) | |
Template method to be overloaded by
subclasses to do what should be done on successfull confirmation.
|
|
do_created ($confirmation) | |
Template method to be overloaded by
subclasses to do what should be done on creation. |
Detailed Description
Confirm onetime login (lost password).
Definition at line 8 of file onetimelogin.confirmationhandler.php.
Member Function Documentation
OnetimeloginConfirmationHandler::do_confirm | ( | $ | confirmation, | |
$ | success | |||
) | [protected] |
Template method to be overloaded by subclasses to do what should be done on successfull confirmation.
- Parameters:
-
DAOConfirmations Data of confirmation, not necessarily up to date, depending on status enum Indicates success or failure
Reimplemented from ConfirmationHandlerBase.
Definition at line 17 of file onetimelogin.confirmationhandler.php.
00017 { 00018 if ($success == self::SUCCESS) { 00019 $user = Users::get($confirmation->id_item); 00020 if ($user && $user->is_active()) { 00021 Users::confirm_email($user); 00022 if (Users::do_login($user)) { 00023 $msg = new Message(tr('You have been automatically logged in. You now can change your password.', 'users')); 00024 $msg->persist(); 00025 $redirect = ActionMapper::get_url('edit_self', $user); 00026 Url::create($redirect)->redirect(); 00027 exit; 00028 } 00029 else { 00030 return new Status(tr('Automatically login in failed', 'users')); 00031 } 00032 } 00033 else { 00034 return new Status(tr('No matching user account was found', 'users')); 00035 } 00036 } 00037 else { 00038 return parent::do_confirm($confirmation, $success); 00039 } 00040 }
OnetimeloginConfirmationHandler::do_created | ( | $ | confirmation | ) | [protected] |
Template method to be overloaded by subclasses to do what should be done on creation.
- Parameters:
-
DAOConfirmations Data of confirmation
- Returns:
- Status
Reimplemented from ConfirmationHandlerBase.
Definition at line 50 of file onetimelogin.confirmationhandler.php.
00050 { 00051 $ret = new Status(); 00052 00053 $user = Users::get($confirmation->id_item); 00054 if ($user) { 00055 Load::commands('generics/mail'); 00056 $cmd = new MailCommand( 00057 tr('One time login', 'users'), 00058 $user->email, 00059 'users/mail/onetimelogin', 00060 array('confirmation' => $confirmation) 00061 ); 00062 $ret->merge($cmd->execute()); 00063 } 00064 else { 00065 $ret->append(tr('Unkown User set on one time login confirmation', 'users')); 00066 } 00067 00068 return $ret; 00069 }
The documentation for this class was generated from the following file:
- contributions/usermanagement/behaviour/confirmationhandlers/onetimelogin.confirmationhandler.php