Move mail_confirm_address out of mail.php
This commit is contained in:
@@ -106,9 +106,9 @@ class EmailRegistrationPlugin extends Plugin
|
||||
throw new ClientException(_m('Not a valid email address.'));
|
||||
}
|
||||
|
||||
$confirm = Confirm_address::getAddress($email, self::CONFIRMTYPE);
|
||||
|
||||
if (empty($confirm)) {
|
||||
try {
|
||||
$confirm = Confirm_address::getByAddress($email, self::CONFIRMTYPE);
|
||||
} catch (NoResultException $e) {
|
||||
$confirm = Confirm_address::saveNew(null, $email, 'register');
|
||||
}
|
||||
|
||||
|
@@ -41,15 +41,15 @@ if (count($args) == 0) {
|
||||
|
||||
$email = $args[0];
|
||||
|
||||
$confirm = Confirm_address::getAddress($email, EmailRegistrationPlugin::CONFIRMTYPE);
|
||||
try {
|
||||
$confirm = Confirm_address::getByAddress($email, EmailRegistrationPlugin::CONFIRMTYPE);
|
||||
|
||||
if (!empty($confirm)) {
|
||||
if (have_option('d', 'dryrun')) {
|
||||
print "[Dry run mode] Deleted confirmation code {$confirm->code} for {$confirm->address}.\n";
|
||||
} else {
|
||||
$confirm->delete();
|
||||
print "Deleted confirmation code {$confirm->code} for {$confirm->address}.\n";
|
||||
}
|
||||
} else {
|
||||
print "Couldn't find an email registration code for {$email}.\n";
|
||||
} catch (NoResultException $e) {
|
||||
print "Exception thrown for {$email}: {$e->getMessage()}";
|
||||
}
|
||||
|
Reference in New Issue
Block a user