Register and lost password tpl added. #10102

1.10.x
Julio Montoya 10 years ago
parent 2b809b7540
commit a893afb1db
  1. 29
      main/auth/inscription.php
  2. 39
      main/auth/lostPassword.php
  3. 7
      main/inc/lib/login.lib.php
  4. 15
      main/inc/lib/template.lib.php
  5. 10
      main/template/default/auth/inscription.tpl
  6. 7
      main/template/default/auth/lost_password.tpl

@ -738,12 +738,13 @@ if ($form->validate()) {
array('info' => $text_after_registration) array('info' => $text_after_registration)
); );
} else { } else {
Display:: display_header($tool_name);
echo Display::page_header($tool_name);
echo $content;
echo $text_after_registration;
Display:: display_footer(); $tpl = new Template($tool_name);
$tpl->assign('inscription_content', $content);
$tpl->assign('text_after_registration', $text_after_registration);
$inscription = $tpl->get_template('auth/inscription.tpl');
$tpl->display($inscription);
} }
} else { } else {
// Custom pages // Custom pages
@ -775,16 +776,18 @@ if ($form->validate()) {
} }
if ($hideHeaders) { if ($hideHeaders) {
Display:: display_no_header(); $showHeader = false;
} else { } else {
Display:: display_header($tool_name); $showHeader = true;
} }
echo Display::page_header($tool_name);
echo $content;
$form->display();
if ($hideHeaders == false) { $tpl = new Template($tool_name, $showHeader, $showHeader);
Display:: display_footer();
} $tpl->assign('inscription_header', Display::page_header($tool_name));
$tpl->assign('inscription_content', $content);
$tpl->assign('form', $form->returnForm());
$inscription = $tpl->get_template('auth/inscription.tpl');
$tpl->display($inscription);
} }
} }

@ -14,9 +14,7 @@
* *
* @package chamilo.auth * @package chamilo.auth
*/ */
/**
* Code
*/
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
// Custom pages // Custom pages
@ -63,20 +61,24 @@ if (CustomPages::enabled()) {
} }
$tool_name = get_lang('LostPassword'); $tool_name = get_lang('LostPassword');
Display :: display_header($tool_name);
$this_section = SECTION_CAMPUS; $this_section = SECTION_CAMPUS;
$tool_name = get_lang('LostPass'); $tool_name = get_lang('LostPass');
// Forbidden to retrieve the lost password // Forbidden to retrieve the lost password
if (api_get_setting('allow_lostpassword') == 'false') { if (api_get_setting('allow_lostpassword') == 'false') {
api_not_allowed(); api_not_allowed(true);
} }
$formToString = '';
if (isset($_GET['reset']) && isset($_GET['id'])) { if (isset($_GET['reset']) && isset($_GET['id'])) {
$message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false); $message = Display::return_message(
Login::reset_password($_GET["reset"], $_GET["id"], true),
'normal',
false
);
$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn btn-back" >'.get_lang('Back').'</a>'; $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn btn-back" >'.get_lang('Back').'</a>';
echo $message; Display::addFlash($message);
} else { } else {
$form = new FormValidator('lost_password'); $form = new FormValidator('lost_password');
$form->addElement('header', $tool_name); $form->addElement('header', $tool_name);
@ -96,16 +98,29 @@ if (isset($_GET['reset']) && isset($_GET['id'])) {
$by_username = true; $by_username = true;
foreach ($users_related_to_username as $user) { foreach ($users_related_to_username as $user) {
if ($_configuration['password_encryption'] != 'none') { if ($_configuration['password_encryption'] != 'none') {
Login::handle_encrypted_password($user, $by_username); $message = Login::handle_encrypted_password($user, $by_username);
} else { } else {
Login::send_password_to_user($user, $by_username); $message = Login::send_password_to_user($user, $by_username);
} }
Display::addFlash($message);
} }
} else { } else {
Display::display_warning_message(get_lang('NoUserAccountWithThisEmailAddress')); Display::addFlash(
Display::return_message(
get_lang('NoUserAccountWithThisEmailAddress'),
'warning'
)
);
} }
} else { } else {
$form->display(); $formToString = $form->returnForm();
} }
} }
Display::display_footer();
$tpl = new Template($tool_name);
$tpl->assign('form', $formToString);
$template = $tpl->get_template('auth/lost_password.tpl');
$tpl->display($template);

@ -124,7 +124,8 @@ class Login
* *
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University * @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/ */
public static function handle_encrypted_password($user, $by_username = false) { public static function handle_encrypted_password($user, $by_username = false)
{
$email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
if ($by_username) { // Show only for lost password if ($by_username) { // Show only for lost password
@ -147,7 +148,7 @@ class Login
if (CustomPages::enabled()) { if (CustomPages::enabled()) {
return get_lang('YourPasswordHasBeenEmailed'); return get_lang('YourPasswordHasBeenEmailed');
} else { } else {
Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed')); return Display::return_message(get_lang('YourPasswordHasBeenEmailed'));
} }
} else { } else {
$admin_email = Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))); $admin_email = Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')));
@ -156,7 +157,7 @@ class Login
if (CustomPages::enabled()) { if (CustomPages::enabled()) {
return $message; return $message;
} else { } else {
Display::display_error_message($message, false); return Display::return_message($message, 'error');
} }
} }
} }

@ -86,17 +86,22 @@ class Template
'autoescape' => false, 'autoescape' => false,
'debug' => true, 'debug' => true,
'auto_reload' => true, 'auto_reload' => true,
'optimizations' => 0, // turn on optimizations with -1 'optimizations' => 0,
'strict_variables' => false, //If set to false, Twig will silently ignore invalid variables // turn on optimizations with -1
'strict_variables' => false,
//If set to false, Twig will silently ignore invalid variables
); );
} else { } else {
$options = array( $options = array(
'cache' => $cache_folder, //path to the cache folder 'cache' => $cache_folder,
//path to the cache folder
'autoescape' => false, 'autoescape' => false,
'debug' => false, 'debug' => false,
'auto_reload' => false, 'auto_reload' => false,
'optimizations' => -1, // turn on optimizations with -1 'optimizations' => -1,
'strict_variables' => false //If set to false, Twig will silently ignore invalid variables // turn on optimizations with -1
'strict_variables' => false
//If set to false, Twig will silently ignore invalid variables
); );
} }

@ -0,0 +1,10 @@
{% extends template ~ "/layout/layout_1_col.tpl" %}
{% block content %}
{{ inscription_header }}
{{ inscription_content }}
{{ form }}
{{ text_after_registration }}
{% endblock %}

@ -0,0 +1,7 @@
{% extends template ~ "/layout/layout_1_col.tpl" %}
{% block content %}
{{ form }}
{% endblock %}
Loading…
Cancel
Save