skala
jmontoya 17 years ago
commit 8a1486fb92
  1. 8
      main/auth/inscription.php
  2. 34
      main/auth/lostPassword.php
  3. 69
      main/auth/lost_password.lib.php

@ -502,8 +502,7 @@ if ($form->validate()) {
EMAIL NOTIFICATION EMAIL NOTIFICATION
--------------------------------------*/ --------------------------------------*/
if (strstr($values['email'], '@')) if (strstr($values['email'], '@')) {
{
// Lets predefine some variables. Be sure to change the from address! // Lets predefine some variables. Be sure to change the from address!
$recipient_name = $values['firstname'].' '.$values['lastname']; $recipient_name = $values['firstname'].' '.$values['lastname'];
$email = $values['email']; $email = $values['email'];
@ -521,7 +520,7 @@ if ($form->validate()) {
} }
} }
$emailbody = get_lang('Dear')." ".stripslashes(Security::remove_XSS($firstname)." ".Security::remove_XSS($lastname)).",\n\n".get_lang('YouAreReg')." ".get_setting('siteName')." ".get_lang('Settings')." ".$values['username']."\n".get_lang('Pass')." : ".stripslashes($values['pass1'])."\n\n".get_lang('Address')." ".get_setting('siteName')." ".get_lang('Is')." : ".$portal_url."\n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n".get_lang('Manager')." ".get_setting('siteName')."\nT. ".get_setting('administratorTelephone')."\n".get_lang('Email')." : ".get_setting('emailAdministrator'); $emailbody = get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",\n\n".get_lang('YouAreReg')." ".get_setting('siteName')." ".get_lang('Settings')." ".$values['username']."\n".get_lang('Pass')." : ".stripslashes($values['pass1'])."\n\n".get_lang('Address')." ".get_setting('siteName')." ".get_lang('Is')." : ".$portal_url."\n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n".get_lang('Manager')." ".get_setting('siteName')."\nT. ".get_setting('administratorTelephone')."\n".get_lang('Email')." : ".get_setting('emailAdministrator');
// Here we are forming one large header line // Here we are forming one large header line
// Every header must be followed by a \n except the last // Every header must be followed by a \n except the last
@ -533,8 +532,7 @@ if ($form->validate()) {
echo "<p>".get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",<br /><br />".get_lang('PersonalSettings').".</p>\n"; echo "<p>".get_lang('Dear')." ".stripslashes(Security::remove_XSS($recipient_name)).",<br /><br />".get_lang('PersonalSettings').".</p>\n";
if (!empty ($values['email'])) if (!empty ($values['email'])) {
{
echo "<p>".get_lang('MailHasBeenSent').".</p>"; echo "<p>".get_lang('MailHasBeenSent').".</p>";
} }

@ -1,28 +1,5 @@
<?php <?php
/* For licensing terms, see /dokeos_license.txt */
// $Id: lostPassword.php 20254 2009-05-02 21:24:08Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
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 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/** /**
============================================================================== ==============================================================================
* SCRIPT PURPOSE : * SCRIPT PURPOSE :
@ -57,16 +34,11 @@ echo '<div class="actions-title">';
echo $tool_name; echo $tool_name;
echo '</div>'; echo '</div>';
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
if (isset ($_GET["reset"]) && isset ($_GET["id"])) if (isset ($_GET["reset"]) && isset ($_GET["id"])) {
{
$msg = reset_password($_GET["reset"], $_GET["id"]); $msg = reset_password($_GET["reset"], $_GET["id"]);
$msg .= '. <br/>'.get_lang('YourPasswordHasBeenEmailed');
$msg1= '<a href="'.api_get_path(WEB_PATH).'main/auth/lostPassword.php" class="fake_button_back" >'.get_lang('Back').'</a>'; $msg1= '<a href="'.api_get_path(WEB_PATH).'main/auth/lostPassword.php" class="fake_button_back" >'.get_lang('Back').'</a>';
Display::display_normal_message($msg);
echo '<br/><br/><div class="actions" >'.$msg1.'</div>'; echo '<br/><br/><div class="actions" >'.$msg1.'</div>';
} } else {
else
{
$form = new FormValidator('lost_password'); $form = new FormValidator('lost_password');
$form->add_textfield('email', get_lang('Email'), false, 'size="40"'); $form->add_textfield('email', get_lang('Email'), false, 'size="40"');
$form->applyFilter('email','strtolower'); $form->applyFilter('email','strtolower');

@ -1,32 +1,10 @@
<?php <?php
// $Id: lost_password.lib.php 18942 2009-03-10 23:42:21Z juliomontoya $ /* For licensing terms, see /dokeos_license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
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 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/** /**
* Enter description here... * Get email headers
* *
* @return unknown * @return string
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University * @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/ */
function get_email_headers() function get_email_headers()
@ -45,7 +23,7 @@ function get_email_headers()
* Enter description here... * Enter description here...
* *
* @param unknown_type $user * @param unknown_type $user
* @param unknown_type $reset * @param boolean $reset
* @return unknown * @return unknown
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University * @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/ */
@ -61,22 +39,24 @@ function get_user_account_list($user, $reset = false)
} }
} }
foreach ($user as $thisUser) { if ($reset==true) {
$secretword = get_secret_word($thisUser["email"]); foreach ($user as $thisUser) {
if ($reset) { $secretword = get_secret_word($thisUser["email"]);
if ($reset) {
$reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secretword."&id=".$thisUser['uid']; $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secretword."&id=".$thisUser['uid'];
} else {
$reset_link = get_lang('Pass')." : $thisUser[password]";
}
$userAccountList[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$thisUser['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.'';
} }
else if ($userAccountList)
{ {
$reset_link = get_lang('Pass')." : $thisUser[password]"; $userAccountList = implode("\n------------------------\n", $userAccountList);
} }
$userAccountList[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$thisUser["loginName"]."\n".get_lang('ResetLink').' : '.$reset_link.''; } else {
} $user = $user[0];
if ($userAccountList) $reset_link = get_lang('Pass')." : $user[password]";
{ $userAccountList = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.'';
$userAccountList = implode("\n------------------------\n", $userAccountList);
} }
return $userAccountList; return $userAccountList;
} }
@ -108,12 +88,9 @@ function send_password_to_user($user)
$sender_name = get_setting('administratorName').' '.get_setting('administratorSurname'); $sender_name = get_setting('administratorName').' '.get_setting('administratorSurname');
$email_admin = get_setting('emailAdministrator'); $email_admin = get_setting('emailAdministrator');
if (@api_mail('', $emailTo, $emailSubject, $emailBody, $sender_name,$email_admin)==1) if (@api_mail('', $emailTo, $emailSubject, $emailBody, $sender_name,$email_admin)==1) {
{
Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed')); Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed'));
} } else {
else
{
$message = get_lang('SystemUnableToSendEmailContact') . Display :: encrypted_mailto_link(get_setting('emailAdministrator'), get_lang('PlatformAdmin')).".</p>"; $message = get_lang('SystemUnableToSendEmailContact') . Display :: encrypted_mailto_link(get_setting('emailAdministrator'), get_lang('PlatformAdmin')).".</p>";
Display::display_error_message($message, false); Display::display_error_message($message, false);
} }
@ -185,10 +162,6 @@ function reset_password($secret, $id)
$user[0]["password"] = api_generate_password(); $user[0]["password"] = api_generate_password();
$crypted = $user[0]["password"]; $crypted = $user[0]["password"];
$crypted = api_get_encrypted_password($crypted); $crypted = api_get_encrypted_password($crypted);
/*if( $userPasswordCrypted)
{
$crypted = md5($crypted);
}*/
api_sql_query("UPDATE ".$tbl_user." SET password='$crypted' WHERE user_id=$id"); api_sql_query("UPDATE ".$tbl_user." SET password='$crypted' WHERE user_id=$id");
return send_password_to_user($user, $your_password_has_been_reset); return send_password_to_user($user, $your_password_has_been_reset);
} }

Loading…
Cancel
Save