open password in a popup

This commit is contained in:
Ralf Becker 2014-04-17 07:37:21 +00:00
parent 41c1c8c777
commit f641c2cec6
4 changed files with 18 additions and 68 deletions

View File

@ -127,7 +127,7 @@ class auth
//echo "Warn about the upcomming change ".$GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change'].' days before that time is reached<br>';
//$result = $GLOBALS['egw_info']['server']['change_pwd_every_x_days'] - $daysLeftUntilChangeReq;
//echo $GLOBALS['egw_info']['server']['change_pwd_every_x_days'].' - '.$daysLeftUntilChangeReq.'='. $result.'<br>';
if (!($app == 'preferences' && $class == 'uipassword' && $method=='change') &&
if (!($app == 'preferences' && $class == 'preferences_password' && $method == 'change') &&
(
($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] &&
($GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['user']['apps']['password']) &&
@ -168,8 +168,11 @@ class auth
'date'=>egw_time::to($alpwchange_val))));
$message = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']);
}
if ($GLOBALS['egw_info']['user']['apps']['password']) egw::redirect_link('/preferences/password.php',array('message'=>$message));
egw::redirect_link('/index.php',array('menuaction'=>'preferences.uipassword.change','message'=>$message));
egw::redirect_link('/index.php',array(
'menuaction' => 'preferences.preferences_password.change',
'message' => $message,
'nopopup' => true,
));
}
}
return true;

View File

@ -1305,15 +1305,15 @@ if ($app == 'home') continue;
}
// allways display password in topmenu, if user has rights to change it
if((($pw_app = $GLOBALS['egw_info']['user']['apps']['preferences']) ||
($pw_app = $GLOBALS['egw_info']['user']['apps']['password'])) &&
if ($GLOBALS['egw_info']['user']['apps']['preferences'] &&
!$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences'))
{
$this->_add_topmenu_item(array(
'name' => $pw_app['name'] == 'password' ? 'about' : $pw_app['name'],
'id' => 'password',
'name' => 'preferences',
'title' => lang('Password'),
'url' => egw::link($pw_app['name'] == 'password' ? $pw_app['index'] : '/index.php?menuaction=preferences.uipassword.change'),
'icon' => common::image($pw_app['icon'],$pw_app['icon_app']),
'url' => 'javascript:egw.open_link("'.
egw::link('/index.php?menuaction=preferences.preferences_password.change').'", "_blank", "400x200")',
));
}

View File

@ -9,7 +9,7 @@
* @version $Id$
*/
class uipassword
class preferences_password
{
var $public_functions = array(
'change' => True
@ -21,17 +21,10 @@ class uipassword
$n_passwd = $_POST['n_passwd'];
$n_passwd_2 = $_POST['n_passwd_2'];
$o_passwd_2 = $_POST['o_passwd_2'];
if (isset($_GET['message'])) $_GET['message'] = str_replace("<br />"," ",html::purify($_GET['message']));
if (isset($_GET['message'])) $message = str_replace("<br />"," ",html::purify($_GET['message']));
if($GLOBALS['egw']->acl->check('nopasswordchange', 1) || $_POST['cancel'])
{
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
{
egw::redirect_link('/preferences/index.php');
}
else
{
egw::redirect_link('/index.php'); // redirect to start page
}
egw_framework::window_close();
}
$GLOBALS['egw']->template->set_file(array(
@ -42,25 +35,7 @@ class uipassword
$GLOBALS['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['egw']->template->set_var('lang_change',lang('Change password'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('form_action',
$GLOBALS['egw_info']['user']['apps']['preferences'] ?
egw::link('/index.php','menuaction=preferences.uipassword.change') :
egw::link('/preferences/password.php'));
if($GLOBALS['egw_info']['server']['auth_type'] != 'ldap')
{
$smtpClassName = 'defaultsmtp';
if (($default_profile_id = emailadmin_bo::getDefaultProfileID()))
{
$bofelamimail = felamimail_bo::forceEAProfileLoad($default_profile_id);
//fetch the smtpClass
//_debug_array($bofelamimail->ogServer);
$smtpClassName = get_class($bofelamimail->ogServer);
}
$GLOBALS['egw']->template->set_var('sql_message',
$smtpClassName != 'defaultsmtp' ? '' :
lang('note: This feature does *not* change your email password. This will need to be done manually.'));
}
$GLOBALS['egw']->template->set_var('form_action',egw::link('/index.php','menuaction=preferences.preferences_password.change'));
$errors = array();
if($_POST['change'])
@ -104,26 +79,22 @@ class uipassword
{
$errors[] = lang('Failed to change password.');
}
egw_framework::message(implode("\n", $errors), 'error');
common::egw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages',common::error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
common::egw_exit(True);
}
else
{
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
{
egw::redirect_link('/preferences/index.php','cd=18');
}
$_GET['message'] = lang('Password changed');
egw_framework::refresh_opener(lang('Password changed'), 'preferences');
egw_framework::window_close();
}
}
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
common::egw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages','<span class="redItalic">'.htmlspecialchars($_GET['message']).'</span>');
$GLOBALS['egw']->template->pfp('out','form');
common::egw_footer();
}

View File

@ -1,24 +0,0 @@
<?php
/**
* EGroupware preferences password change without preferences rights
*
* @package preferences
* @link http://www.egroupware.org
* @author Ralf Becker <rb@stylite.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
$GLOBALS['egw_info'] = array(
'flags' => array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'preferences',
)
);
include('../header.inc.php');
$GLOBALS['egw']->template = new Template(common::get_tpl_dir('preferences'));
translation::add_app('preferences');
ExecMethod('preferences.uipassword.change');
common::egw_footer();