<?php

/**
 * Snippet to display and action the members login form.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS\module\members
 * @copyright Copyright (c) 2012 - 2013 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/* @var $tplEngine cfTemplateEngine */
$controller = $tplEngine->controller;

// Force other computers to logout
$form = new flForm(clearFusionCMS::getRequest(), 'logoutallform', $controller->content->getPageURI($controller->pageData['id']), true);

$logoutOthers = new flFormElementSubmit($form, 'logoutothers');
$logoutOthers->setCaption(__('Logout Other Computers', 'members'))->setCSS('accent')
	->setDescription(__('Force other computers that you may be logged in on to be logged out.', 'members'));

$show = true;
if($form->isSubmitted() && $form->isValid()) {
	clearFusionCMS::getUser()->regenerateAuth();
	$show = false;
	echo __('<p>All other computers have been logged out of your account.</p>', 'members');
}

if($show)
	echo $form->render($tplEngine->getCodeBuffer());
