BUG 0000 forgot password - complete files
This commit is contained in:
committed by
Erik Amaru Ortiz
parent
a1725f03d5
commit
4c16687e37
27
workflow/engine/methods/login/forgotPassword.php
Normal file
27
workflow/engine/methods/login/forgotPassword.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* forgotPassword.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
$G_PUBLISH = new Publisher ();
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '', $aFields, SYS_URI . 'login/retrivePassword.php');
|
||||
G::RenderPage ( "publish" );
|
||||
116
workflow/engine/methods/login/retrivePassword.php
Normal file
116
workflow/engine/methods/login/retrivePassword.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
$data=$_POST['form'];
|
||||
global $RBAC;
|
||||
require_once PATH_RBAC."model/RbacUsers.php";
|
||||
$oUser = new RbacUsers();
|
||||
$aFields=$oUser->getByUsername($data['USR_USERNAME']);
|
||||
if($aFields['USR_EMAIL']==$data['USR_EMAIL'])
|
||||
{
|
||||
require_once ( "classes/class.pmFunctions.php" );
|
||||
$aSetup = getEmailConfiguration();
|
||||
// generate a new password
|
||||
$newPass=G::generate_password();
|
||||
require_once 'classes/model/Users.php';
|
||||
$oUser = new Users();
|
||||
$aData['USR_UID'] = $aFields['USR_UID'];
|
||||
$aData['USR_PASSWORD'] = md5($newPass);
|
||||
$RBAC->updateUser($aData,'PROCESSMAKER_ADMIN');
|
||||
G::LoadClass("system");
|
||||
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
|
||||
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
|
||||
$msg = '<h3>'.G::LoadTranslation('ID_THANKS_USE_SERVICES').'.</h3>';
|
||||
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$aFields['USR_USERNAME'].'</strong></p>';
|
||||
$msg .='<p>'.G::LoadTranslation('ID_YOUR_PASSWORD_IS').' : <strong>'.$newPass.'</strong></p>';
|
||||
switch ($aSetup['MESS_ENGINE']) {
|
||||
case 'MAIL':
|
||||
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
|
||||
break;
|
||||
case 'PHPMAILER':
|
||||
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
|
||||
break;
|
||||
case 'OPENMAIL':
|
||||
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
|
||||
break;
|
||||
}
|
||||
|
||||
$sBody = "
|
||||
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
|
||||
<tbody><tr><td><img id='logo' src='http://".$_SERVER['SERVER_NAME']."/images/processmaker.logo.jpg' /></td></tr>
|
||||
<tr><td style='font-size: 14px;'>$msg</td></tr>
|
||||
<tr><td style='vertical-align:middel;'>
|
||||
<br /><hr><b>This Business Process is powered by ProcessMaker ver. ".System::getVersion().".<b><br />
|
||||
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
|
||||
</tr></tbody></table>";
|
||||
|
||||
G::LoadClass('spool');
|
||||
$oSpool = new spoolRun();
|
||||
|
||||
$oSpool->setConfig( array(
|
||||
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
|
||||
'MESS_SERVER' => $aSetup['MESS_SERVER'],
|
||||
'MESS_PORT' => $aSetup['MESS_PORT'],
|
||||
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
|
||||
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
|
||||
'SMTPAuth' => $aSetup['MESS_RAUTH'],
|
||||
'SMTPSecure' => $aSetup['SMTPSecure']
|
||||
));
|
||||
|
||||
$oSpool->create(array(
|
||||
'msg_uid' => '',
|
||||
'app_uid' => '',
|
||||
'del_index' => 0,
|
||||
'app_msg_type' => 'TEST',
|
||||
'app_msg_subject' => $sSubject,
|
||||
'app_msg_from' => $sFrom,
|
||||
'app_msg_to' => $data['USR_EMAIL'],
|
||||
'app_msg_body' => $sBody,
|
||||
'app_msg_cc' => '',
|
||||
'app_msg_bcc' => '',
|
||||
'app_msg_attach' => '',
|
||||
'app_msg_template' => '',
|
||||
'app_msg_status' => 'pending',
|
||||
'app_msg_attach'=>''
|
||||
));
|
||||
|
||||
$oSpool->sendMail();
|
||||
G::header ("location: login.html");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$msg=G::LoadTranslation('ID_USER_NOT_REGISTER');
|
||||
G::SendTemporalMessage ($msg, "warning");
|
||||
$G_PUBLISH = new Publisher ();
|
||||
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/forgotPassword', '','', SYS_URI . 'login/authentication.php' );
|
||||
G::RenderPage ( "publish" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
44
workflow/engine/methods/setup/loginSettings.php
Normal file
44
workflow/engine/methods/setup/loginSettings.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* main.php Cases List main processor
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
G::loadClass('configuration');
|
||||
$oConf = new Configurations;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oServerConf =& serverConf::getSingleton();
|
||||
|
||||
$oHeadPublisher->addExtJsScript('setup/loginSettings', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('setup/loginSettings'); //adding a html file .html.
|
||||
|
||||
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
|
||||
|
||||
$defaultOption = isset($oConf->aConfig['login_enableForgotPassword'])? $oConf->aConfig['login_enableForgotPassword']: false;
|
||||
$defaultLanguaje = isset($oConf->aConfig['login_defaultLanguage'])? $oConf->aConfig['login_defaultLanguage']: 'en';
|
||||
|
||||
|
||||
$oHeadPublisher->assign( 'currentLang', $defaultLanguaje); //current language
|
||||
$oHeadPublisher->assign( 'currentOption', $defaultOption); //current option
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
37
workflow/engine/methods/setup/loginSettingsAjax.php
Normal file
37
workflow/engine/methods/setup/loginSettingsAjax.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
$request = isset($_POST['request'])? $_POST['request']: (isset($_GET['request'])? $_GET['request']: null);
|
||||
|
||||
switch($request){
|
||||
case 'getLangList':
|
||||
|
||||
$Translations = G::getModel('Translation');
|
||||
$result = new stdClass();
|
||||
$result->rows = Array();
|
||||
|
||||
$langs = $Translations->getTranslationEnvironments();
|
||||
foreach($langs as $lang){
|
||||
$result->rows[] = Array('LAN_ID'=>$lang['LOCALE'], 'LAN_NAME'=>$lang['LANGUAGE']);
|
||||
}
|
||||
|
||||
print(G::json_encode($result));
|
||||
break;
|
||||
case 'saveSettings':
|
||||
|
||||
G::LoadClass('configuration');
|
||||
$conf = new Configurations;
|
||||
$conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
|
||||
|
||||
$conf->aConfig['login_enableForgotPassword'] = $_POST['acceptRP'];
|
||||
$conf->aConfig['login_defaultLanguage'] = $_POST['lang'];
|
||||
$conf->saveConfig('ENVIRONMENT_SETTINGS', '');
|
||||
|
||||
$response->success = true;
|
||||
if ($_POST['acceptRP'])
|
||||
$response->enable = true;
|
||||
else
|
||||
$response->enable = false;
|
||||
|
||||
echo G::json_encode($response);
|
||||
|
||||
break;
|
||||
}
|
||||
2
workflow/engine/templates/setup/loginSettings.html
Normal file
2
workflow/engine/templates/setup/loginSettings.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<div style="width: 600px; height 100px">
|
||||
<div id="processes-panel"></div>
|
||||
101
workflow/engine/templates/setup/loginSettings.js
Normal file
101
workflow/engine/templates/setup/loginSettings.js
Normal file
@@ -0,0 +1,101 @@
|
||||
Ext.onReady(function(){
|
||||
|
||||
var cmbLanguages = new Ext.form.ComboBox({
|
||||
fieldLabel : TRANSLATIONS.ID_CACHE_LANGUAGE, // 'Language'
|
||||
hiddenName : 'lang',
|
||||
store : new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
url : 'loginSettingsAjax',
|
||||
method : 'POST'
|
||||
}),
|
||||
baseParams : {request : 'getLangList'},
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root : 'rows',
|
||||
fields : [ {name : 'LAN_ID'}, {name : 'LAN_NAME'} ]
|
||||
})
|
||||
}),
|
||||
valueField : 'LAN_ID',
|
||||
displayField : 'LAN_NAME',
|
||||
emptyText : 'Select',
|
||||
selectOnFocus : true,
|
||||
editable : false,
|
||||
allowBlank : false,
|
||||
listeners:{
|
||||
select: function(){ChangeSettings('1');}
|
||||
}
|
||||
});
|
||||
|
||||
cmbLanguages.store.on('load',function(){ cmbLanguages.setValue ( currentLang ) });
|
||||
cmbLanguages.store.load();
|
||||
saveButton = new Ext.Action({
|
||||
text : _('ID_SAVE_SETTINGS'),
|
||||
disabled : true,
|
||||
handler : saveSettings
|
||||
});
|
||||
|
||||
loginFields = new Ext.form.FieldSet({
|
||||
title: _('ID_LOGIN_SETTINGS'),
|
||||
items : [
|
||||
cmbLanguages,
|
||||
{
|
||||
xtype: 'checkbox',
|
||||
checked: currentOption,
|
||||
name: 'acceptRP',
|
||||
fieldLabel: _('ID_ENABLE_FOTGOT_PASSWORD'),
|
||||
id: 'ch_ii',
|
||||
listeners:{
|
||||
check:function(){ChangeSettings('2');}
|
||||
}
|
||||
|
||||
},
|
||||
],
|
||||
buttons : [saveButton]
|
||||
});
|
||||
|
||||
|
||||
var frm = new Ext.FormPanel( {
|
||||
title: ' ',
|
||||
id:'frm',
|
||||
labelWidth: 150,
|
||||
width:400,
|
||||
labelAlign:'right',
|
||||
autoScroll: true,
|
||||
bodyStyle:'padding:2px',
|
||||
waitMsgTarget : true,
|
||||
frame: true,
|
||||
|
||||
defaults: {
|
||||
allowBlank: false,
|
||||
msgTarget: 'side',
|
||||
align:'center'
|
||||
},
|
||||
items:[ loginFields ]
|
||||
|
||||
});
|
||||
//render to process-panel
|
||||
frm.render(document.body);
|
||||
});
|
||||
|
||||
function saveSettings() {
|
||||
Ext.getCmp('frm').getForm().submit( {
|
||||
url : 'loginSettingsAjax?request=saveSettings',
|
||||
waitMsg : _('ID_SAVING_PROCESS'),
|
||||
timeout : 36000,
|
||||
success : function(obj, resp) {
|
||||
//nothing to do
|
||||
response = Ext.decode(resp.response.responseText);
|
||||
if (response.enable)
|
||||
parent.PMExt.notify(_('ID_LOGIN_SETTINGS'),_('ID_ENABLE_FORGOT_PASSWORD'));
|
||||
else
|
||||
parent.PMExt.notify(_('ID_LOGIN_SETTINGS'),_('ID_DISABLE_FORGOT_PASSWORD'));
|
||||
saveButton.disable();
|
||||
},
|
||||
failure: function(obj, resp) {
|
||||
Ext.Msg.alert( _('ID_ERROR'), resp.result.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ChangeSettings = function(iType){
|
||||
saveButton.enable();
|
||||
}
|
||||
124
workflow/engine/xmlform/login/forgotPassword.xml
Normal file
124
workflow/engine/xmlform/login/forgotPassword.xml
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px">
|
||||
<TITLE type="title">
|
||||
<en>I forgot my password</en>
|
||||
</TITLE>
|
||||
<USR_USERNAME type="text" size="30" maxlength="50" required="true" validate="Login">
|
||||
<en>User</en>
|
||||
</USR_USERNAME>
|
||||
<USR_EMAIL type="text" size="30" required="true" maxlength="32">
|
||||
<en>Email</en>
|
||||
</USR_EMAIL>
|
||||
<URL type="hidden"/>
|
||||
<LOGIN_VERIFY_MSG type="private" showInTable="0"/>
|
||||
<BSUBMIT type="submit">
|
||||
<en>Send Request</en>
|
||||
</BSUBMIT>
|
||||
<JS type="javascript"><![CDATA[
|
||||
var panel;
|
||||
|
||||
function processHbInfo(){
|
||||
ajax_server="../services/processHeartBeat_Ajax.php";
|
||||
parameters="action=processInformation";
|
||||
method="POST";
|
||||
callback="";
|
||||
asynchronous=true;
|
||||
ajax_post(ajax_server, parameters, method, callback, asynchronous );
|
||||
};
|
||||
|
||||
function showGettingStarted () {
|
||||
panel = new leimnud.module.panel();
|
||||
panel.options={
|
||||
size :{w:620,h:500},
|
||||
position:{x:50,y:50,center:true},
|
||||
control :{close:true,resize:false},fx:{modal:true},
|
||||
statusBar:false,
|
||||
fx :{shadow:true,modal:true}
|
||||
};
|
||||
panel.make();
|
||||
panel.loader.show();
|
||||
var r = new leimnud.module.rpc.xmlhttp({
|
||||
url:"../services/login_getStarted.php",
|
||||
method:"POST"
|
||||
});
|
||||
r.callback=function(rpc) {
|
||||
panel.loader.hide();
|
||||
panel.addContent(rpc.xmlhttp.responseText);
|
||||
};
|
||||
r.make();
|
||||
};
|
||||
|
||||
var saveConfig = function() {
|
||||
if(document.getElementById("getStarted").checked==true) {
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : '../login/login_Ajax',
|
||||
async : false,
|
||||
method: 'POST',
|
||||
args : 'function=getStarted_save'
|
||||
});
|
||||
oRPC.make();
|
||||
}
|
||||
panel.remove();
|
||||
}
|
||||
|
||||
var dynaformOnload = function() {
|
||||
setFocus (getField ('USR_USERNAME'));
|
||||
if (flagHeartBeat) processHbInfo();
|
||||
if (flagGettingStarted) showGettingStarted();
|
||||
};
|
||||
|
||||
var openInfoPanel = function() {
|
||||
var oInfoPanel = new leimnud.module.panel();
|
||||
oInfoPanel.options = {
|
||||
size :{w:500,h:424},
|
||||
position:{x:0,y:0,center:true},
|
||||
title :'System Information',
|
||||
theme :'processmaker',
|
||||
control :{
|
||||
close :true,
|
||||
drag :false
|
||||
},
|
||||
fx:{
|
||||
modal:true
|
||||
}
|
||||
};
|
||||
oInfoPanel.setStyle = {modal: {
|
||||
backgroundColor: 'white'
|
||||
}};
|
||||
oInfoPanel.make();
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : '../login/dbInfo',
|
||||
async : false,
|
||||
method: 'POST',
|
||||
args : ''
|
||||
});
|
||||
oRPC.make();
|
||||
oInfoPanel.addContent(oRPC.xmlhttp.responseText);
|
||||
};
|
||||
|
||||
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
|
||||
setNestedProperty(this, Array('disabled'), 'true');
|
||||
setNestedProperty(this, Array('value'), @@LOGIN_VERIFY_MSG);
|
||||
lang = getField('USER_LANG').value;
|
||||
createCookie('pmos_generik', '{"lang":"'+lang+'"}', 365);
|
||||
|
||||
var client = getBrowserClient();
|
||||
|
||||
if (client.browser != "firefox"){
|
||||
document.login.submit();
|
||||
}
|
||||
}.extend(document.getElementById('form[BSUBMIT]')));
|
||||
|
||||
try{
|
||||
c = new String(readCookie('pmos_generik'));
|
||||
o = eval("("+c+")");
|
||||
if( o != null){
|
||||
getField('USER_LANG').value = o.lang;
|
||||
}
|
||||
}
|
||||
catch(e){}
|
||||
|
||||
]]></JS>
|
||||
|
||||
|
||||
</dynaForm>
|
||||
Reference in New Issue
Block a user