streams/Code/Module/Email_resend.php

46 lines
1 KiB
PHP
Raw Normal View History

<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module;
2022-02-16 04:08:28 +00:00
use Code\Web\Controller;
2022-03-08 00:03:32 +00:00
use Code\Lib\Account;
2022-01-25 01:26:12 +00:00
2021-12-02 23:02:31 +00:00
class Email_resend extends Controller
{
2021-12-02 23:02:31 +00:00
public function post()
{
2021-12-02 23:02:31 +00:00
if ($_POST['token']) {
2022-01-25 01:26:12 +00:00
if (!Account::approve(trim($_POST['token']))) {
2021-12-02 23:02:31 +00:00
notice(t('Token verification failed.'));
}
}
}
2021-12-02 23:02:31 +00:00
public function get()
{
2021-12-02 23:02:31 +00:00
if (argc() > 1) {
$result = false;
$email = hex2bin(argv(1));
2021-12-02 23:02:31 +00:00
if ($email) {
2022-01-25 01:26:12 +00:00
$result = Account::verify_email_address(['resend' => true, 'email' => $email]);
2021-12-02 23:02:31 +00:00
}
2021-12-02 23:02:31 +00:00
if ($result) {
notice(t('Email verification resent'));
} else {
notice(t('Unable to resend email verification message.'));
}
2021-12-02 23:02:31 +00:00
goaway(z_root() . '/email_validation/' . bin2hex($email));
}
2021-12-02 23:02:31 +00:00
// @todo - one can provide a form here to resend the mail
2022-09-04 01:35:50 +00:00
// after directing to here if a successful login was attempted from an unverified address.
2021-12-02 23:02:31 +00:00
}
2018-01-27 22:55:44 +00:00
}