2018-01-27 20:51:48 +00:00
< ? php
namespace Zotlabs\Module ;
class Email_validation extends \Zotlabs\Web\Controller {
function post () {
2018-03-01 05:15:26 +00:00
$success = false ;
2018-01-27 20:51:48 +00:00
if ( $_POST [ 'token' ]) {
2018-01-29 10:41:45 +00:00
// This will redirect internally on success unless the channel is auto_created
2018-03-01 05:15:26 +00:00
if ( account_approve ( trim ( basename ( $_POST [ 'token' ])))) {
$success = true ;
2018-01-29 10:41:45 +00:00
if ( get_config ( 'system' , 'auto_channel_create' )) {
$next_page = get_config ( 'system' , 'workflow_channel_next' , 'profiles' );
}
if ( $next_page ) {
goaway ( z_root () . '/' . $next_page );
}
}
2018-01-27 20:51:48 +00:00
}
2018-03-01 05:15:26 +00:00
if ( ! $success ) {
notice ( t ( 'Token verification failed.' ) . EOL );
}
2018-01-27 20:51:48 +00:00
}
function get () {
if ( argc () > 1 ) {
$email = hex2bin ( argv ( 1 ));
}
$o = replace_macros ( get_markup_template ( 'email_validation.tpl' ), [
'$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' ), '' , '' ],
]);
return $o ;
}
}