streams/Zotlabs/Module/Email_resend.php

46 lines
1 KiB
PHP
Raw Normal View History

<?php
namespace Zotlabs\Module;
2021-12-02 22:33:36 +00:00
use Zotlabs\Web\Controller;
2022-01-25 01:26:12 +00:00
use Zotabs\Lib\Account;
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
// after directing to here if a succesful login was attempted from an unverified address.
}
2018-01-27 22:55:44 +00:00
}