BUG 0000 Forgot passwod feature (finished)

This commit is contained in:
Erik Amaru Ortiz
2011-06-06 06:23:18 -04:00
parent 4d315e63b7
commit b25c51ab03
7 changed files with 79 additions and 38 deletions

View File

@@ -45,7 +45,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1)
$G_TMP_MENU->AddIdRawOption('ADDITIONAL_TABLES', '../additionalTables/additionalTablesList', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings'); $G_TMP_MENU->AddIdRawOption('ADDITIONAL_TABLES', '../additionalTables/additionalTablesList', G::LoadTranslation('ID_ADDITIONAL_TABLES'), 'icon-tables.png','', 'settings');
$G_TMP_MENU->AddIdRawOption('WEBSERVICES', 'webServices', G::LoadTranslation('ID_WEB_SERVICES'), 'icon-webservices.png', '', 'settings'); $G_TMP_MENU->AddIdRawOption('WEBSERVICES', 'webServices', G::LoadTranslation('ID_WEB_SERVICES'), 'icon-webservices.png', '', 'settings');
$G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_LOG_CASE_SCHEDULER'), "icon-logs-list.png",'', 'settings'); $G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_LOG_CASE_SCHEDULER'), "icon-logs-list.png",'', 'settings');
$G_TMP_MENU->AddIdRawOption('LOGIN', 'loginSettings', G::LoadTranslation('LOGIN'), "",'', 'settings');
//tools options //tools options
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1)

View File

@@ -1,25 +1,31 @@
<?php <?php
$data=$_POST['form']; $data = $_POST['form'];
global $RBAC; global $RBAC;
require_once PATH_RBAC."model/RbacUsers.php"; require_once PATH_RBAC."model/RbacUsers.php";
$oUser = new RbacUsers(); require_once ( "classes/class.pmFunctions.php" );
$aFields=$oUser->getByUsername($data['USR_USERNAME']); require_once 'classes/model/Users.php';
if($aFields['USR_EMAIL']==$data['USR_EMAIL']) G::LoadClass("system");
{
require_once ( "classes/class.pmFunctions.php" ); $rbacUser = new RbacUsers();
$user = new Users();
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
if($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
$aSetup = getEmailConfiguration(); $aSetup = getEmailConfiguration();
// generate a new password $newPass = G::generate_password();
$newPass=G::generate_password();
require_once 'classes/model/Users.php'; $aData['USR_UID'] = $userData['USR_UID'];
$oUser = new Users();
$aData['USR_UID'] = $aFields['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass); $aData['USR_PASSWORD'] = md5($newPass);
$RBAC->updateUser($aData,'PROCESSMAKER_ADMIN');
G::LoadClass("system"); $rbacUser->update($aData);
$user->update($aData);
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>'; $sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ; $sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
$msg = '<h3>'.G::LoadTranslation('ID_THANKS_USE_SERVICES').'.</h3>'; $msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$aFields['USR_USERNAME'].'</strong></p>'; $msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>'; $msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
switch ($aSetup['MESS_ENGINE']) { switch ($aSetup['MESS_ENGINE']) {
case 'MAIL': case 'MAIL':
@@ -74,11 +80,9 @@ if($aFields['USR_EMAIL']==$data['USR_EMAIL'])
$oSpool->sendMail(); $oSpool->sendMail();
G::header ("location: login.html"); G::header ("location: login.html");
} G::SendTemporalMessage ('ID_NEW_PASSWORD_SENT', "info");
} else {
else $msg = G::LoadTranslation('ID_USER') . ' ' . $data['USR_USERNAME'] . ' '. G::LoadTranslation('ID_USER_NOT_REGISTERED');
{
$msg=G::LoadTranslation('ID_USER_NOT_REGISTER');
G::SendTemporalMessage ($msg, "warning"); G::SendTemporalMessage ($msg, "warning");
$G_PUBLISH = new Publisher (); $G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '','', SYS_URI . 'login/authentication.php' ); $G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '','', SYS_URI . 'login/authentication.php' );

View File

@@ -44,17 +44,7 @@ switch($request){
); );
} }
} }
if($_GET['menu'] == 'settings' ){
$items[] = Array(
'id' => 'login',
'url' => 'loginSettings',
'text' => 'Login',
'loaded' => true,
'leaf' => true,
'cls' => 'pm-tree-node',
'iconCls'=> 'ICON_'
);
}
if( isset($_SESSION['DEV_FLAG']) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings' ){ if( isset($_SESSION['DEV_FLAG']) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings' ){
$items[] = Array( $items[] = Array(
'id' => 'translations', 'id' => 'translations',

View File

@@ -755,6 +755,13 @@ antes funcionaba.
background-position:0 -14833px !important; background-position:0 -14833px !important;
} }
.ICON_LOGIN{
/*ss_key*/
background-image:url( /images/icons_silk/sprites.png) !important;
background-position:0 -8929px !important;
}
/* Language Support module styles*/ /* Language Support module styles*/
.upload-icon { .upload-icon {
background: url('/images/cases-documents.png') no-repeat 0 0 !important; background: url('/images/cases-documents.png') no-repeat 0 0 !important;

View File

@@ -0,0 +1,41 @@
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit="return validateForm('{$form_objectRequiredFields}');"> <div class="borderForm" style="width:{$form_width}; padding-left:0; padding-right:0; border-width:{$form_border};">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="height:{$form_height};" >
<table width="99%">
<tr>
<td valign='top'>
<input type="hidden" class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="{$form_objectRequiredFields}" />
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" />
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class='FormTitle' colspan="2" align="">{$form.TITLE}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$USR_USERNAME}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.USR_USERNAME}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$USR_EMAIL}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.USR_EMAIL}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.URL}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.BSUBMIT}&nbsp;{$form.BCANCEL}</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>
<script type="text/javascript">
{$form.JS}
</script>
</form>
<script type="text/javascript">
try {literal}{{/literal} dynaformSetFocus();}catch(e){literal}{{/literal}}
</script>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px"> <dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px" enabletemplate="1">
<TITLE type="title"> <TITLE type="title">
<en>I forgot my password</en> <en>I forgot my password</en>
</TITLE> </TITLE>
@@ -14,6 +14,9 @@
<BSUBMIT type="submit"> <BSUBMIT type="submit">
<en>Send Request</en> <en>Send Request</en>
</BSUBMIT> </BSUBMIT>
<BCANCEL type="button" onclick="history.back()">
<en>Cancel</en>
</BCANCEL>
<JS type="javascript"><![CDATA[ <JS type="javascript"><![CDATA[
var panel; var panel;

View File

@@ -609,11 +609,7 @@ $startingTime = array_sum(explode(' ',microtime()));
} }
if ($bRedirect) { if ($bRedirect) {
if (empty($_POST)) { if (empty($_POST)) {
//if(SYS_TARGET != 'forgotPassword')
header('location: ' . SYS_URI . 'login/login?u=' . urlencode($_SERVER['REQUEST_URI'])); header('location: ' . SYS_URI . 'login/login?u=' . urlencode($_SERVER['REQUEST_URI']));
//else
//header('location: ' . SYS_URI . 'login/forgotPassword');
} }
else { else {
header('location: ' . SYS_URI . 'login/login'); header('location: ' . SYS_URI . 'login/login');