* Copyright © 2014 Strangecode, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
*
*
*
*
* @author Quinn Comendant
* @version 1.0
* @since 10 Sep 2014 10:20:10
*/
/********************************************************************
* CONFIG
********************************************************************/
require_once dirname(__FILE__) . '/_config.inc.php';
/********************************************************************
* MAIN
********************************************************************/
if (!$auth->isLoggedIn()) {
$app->raiseMsg(sprintf(_("Please login to continue with email confirmation."), null), MSG_SUCCESS, __FILE__, __LINE__);
$app->setBoomerangURL(absoluteMe(), 'login');
$app->dieURL(sprintf('/login.php'));
}
//
// Resend mode.
//
if ('resend' == getFormData('op')) {
// User granted user.edit can reset arbitrary user_id, else reset only self.
$user_id = $acl->check('user_id:' . $auth->get('user_id'), 'user.edit') ? getFormData('user_id', $auth->get('user_id')) : $auth->get('user_id');
$user = User::get(array('user_id' => $user_id));
if (User::requestEmailConfirmation($user_id)) {
$app->raiseMsg(sprintf(_("A confirmation email has been sent to %s. Click on the confirmation link in the email to activate your account."), $user['email']), MSG_NOTICE, __FILE__, __LINE__);
$app->dieBoomerangURL();
}
}
//
// Confirmation mode.
//
if ('' != getFormData('c')) {
// Run the verification. This function dies on failure.
User::validateEmailConfirmation(getFormData('c'));
// Valid!
User::completeEmailConfirmation($auth->get('user_id'));
}
$app->dieBoomerangURL();