Minor login form

skala
Julio Montoya 14 years ago
parent 02e29ca812
commit 25c5780787
  1. 54
      main/inc/lib/main_api.lib.php

@ -2362,14 +2362,13 @@ function api_not_allowed($print_headers = false) {
global $this_section;
$tpl = new Template();
if (api_get_setting('use_custom_pages') == 'true') {
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
CustomPages::displayPage('index-unlogged');
exit;
}
$template_file = $tpl->get_template('layout/layout_1_col.tpl');
if (api_get_setting('use_custom_pages') == 'true') {
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
CustomPages::displayPage('index-unlogged');
exit;
}
$origin = isset($_GET['origin']) ? $_GET['origin'] : '';
@ -2384,8 +2383,7 @@ function api_not_allowed($print_headers = false) {
//$msg = Display::return_message(get_lang('NotAllowedClickBack').'<br /><br /><a href="'.$_SERVER['HTTP_REFERER'].'">'.get_lang('BackToPreviousPage').'</a><br />', 'error', false);
$msg = Display::return_message(get_lang('NotAllowedClickBack'), 'error', false);
$msg = Display::div($msg, array('align'=>'center'));
$tpl->assign('content', $msg);
$tpl->assign('content', $msg);
$show_headers = 0;
if ((!headers_sent() || $print_headers) && $origin != 'learnpath') {
@ -2398,8 +2396,8 @@ function api_not_allowed($print_headers = false) {
if ((isset($user) && !api_is_anonymous()) && (!isset($course) || $course == -1) && empty($_GET['cidReq'])) {
//if the access is not authorized and there is some login information
// but the cidReq is not found, assume we are missing course data and send the user
// to the user_portal
$tpl->display($template_file);
// to the user_portal
$tpl->display_one_col_template();
exit;
}
@ -2411,41 +2409,35 @@ function api_not_allowed($print_headers = false) {
exit;
}
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
$form = new FormValidator('formLogin', 'post', api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']));
$form = new FormValidator('formLogin', 'post', api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']), null, array('class'=>'form-stacked'));
$form->addElement('text', 'login', get_lang('UserName'), array('size' => 17));
$form->addElement('password', 'password', get_lang('Password'), array('size' => 17));
$form->addElement('style_submit_button', 'submitAuth', get_lang('LoginEnter'),'class="login"');
$form->addElement('style_submit_button', 'submitAuth', get_lang('LoginEnter'),'class="a_button gray"');
if ((!headers_sent() || $print_headers) && $origin != 'learnpath') {
Display::display_header(null);
}
Display::display_error_message(get_lang('NotAllowed').'<br />'.get_lang('PleaseLoginAgainFromFormBelow').'<br />', false);
$content = Display::return_message(get_lang('NotAllowed').'<br />'.get_lang('PleaseLoginAgainFromFormBelow').'<br />', 'error', false);
echo '<div class="menu" id="menu" style="float:left">';
echo '<br />';
$content .= '<div style="margin: 0 auto; width: 200px;" class="menu-wrapper"><div class="menu" id="menu">';
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<div><label>{label}</label></div><div>{element}</div>');
$form->display();
echo '</div>';
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
if ($print_headers && $origin != 'learnpath') {
Display::display_footer();
}
//$renderer->setElementTemplate('<div><label>{label}</label></div><div>{element}</div>');
$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}</div></div>');
$content .= $form->return_form();
$content .='</div></div>';
$tpl->assign('content', $content);
$tpl->display_one_col_template();
die();
}
if (!empty($user) && !api_is_anonymous()) {
$tpl->display($template_file);
$tpl->display_one_col_template();
exit;
}
//if no course ID was included in the requested URL, redirect to homepage
$msg = Display::return_message(get_lang('NotAllowed').'<br /><br /><a href="'.$home_url.'">'.get_lang('PleaseLoginAgainFromHomepage').'</a><br />', 'error', false);
$msg = Display::div($msg, array('align'=>'center'));
$tpl->assign('content', $msg);
$tpl->display($template_file);
$tpl->assign('content', $msg);
$tpl->display_one_col_template();
exit;
}

Loading…
Cancel
Save