2018-01-27 20:51:48 +00:00
< ? php
2022-02-16 04:08:28 +00:00
namespace Code\Module ;
2018-01-27 20:51:48 +00:00
2022-02-16 04:08:28 +00:00
use Code\Web\Controller ;
use Code\Lib\Account ;
use Code\Render\Theme ;
2022-02-12 20:43:29 +00:00
2022-01-25 01:26:12 +00:00
2021-12-02 23:02:31 +00:00
class Email_validation extends Controller
{
public function post ()
{
$success = false ;
if ( $_POST [ 'token' ]) {
// This will redirect internally on success unless the channel is auto_created
2022-01-25 01:26:12 +00:00
if ( Account :: approve ( trim ( basename ( $_POST [ 'token' ])))) {
2021-12-02 23:02:31 +00:00
$success = true ;
if ( get_config ( 'system' , 'auto_channel_create' )) {
2022-10-08 08:57:16 +00:00
$next_page = get_config ( 'system' , 'workflow_channel_next' , 'settings/profile_edit' );
2021-12-02 23:02:31 +00:00
}
if ( $next_page ) {
goaway ( z_root () . '/' . $next_page );
}
}
}
if ( ! $success ) {
notice ( t ( 'Token verification failed.' ) . EOL );
}
}
public function get ()
{
if ( argc () > 1 ) {
$email = hex2bin ( argv ( 1 ));
}
2022-10-08 08:57:16 +00:00
return replace_macros ( Theme :: get_template ( 'email_validation.tpl' ), [
2021-12-02 23:02:31 +00:00
'$title' => t ( 'Email Verification Required' ),
'$desc' => sprintf ( t ( 'A verification token was sent to your email address [%s]. Enter that token here to complete the account verification step. Please allow a few minutes for delivery, and check your spam folder if you do not see the message.' ), $email ),
'$resend' => t ( 'Resend Email' ),
'$email' => bin2hex ( $email ),
'$submit' => t ( 'Submit' ),
'$token' => [ 'token' , t ( 'Validation token' ), '' , '' ],
]);
}
2021-12-03 03:01:39 +00:00
}