diff --git a/preferences/inc/class.preferences_password.inc.php b/preferences/inc/class.preferences_password.inc.php index 4360d91d64..36bdae790a 100644 --- a/preferences/inc/class.preferences_password.inc.php +++ b/preferences/inc/class.preferences_password.inc.php @@ -15,87 +15,79 @@ class preferences_password 'change' => True ); - function change() + /** + * Change password function + * process change password form + * + * @param type $content + */ + function change($content = null) { - //_debug_array($GLOBALS['egw_info']['user']); - $n_passwd = $_POST['n_passwd']; - $n_passwd_2 = $_POST['n_passwd_2']; - $o_passwd_2 = $_POST['o_passwd_2']; - if (isset($_GET['message'])) $message = str_replace("
"," ",html::purify($_GET['message'])); - if($GLOBALS['egw']->acl->check('nopasswordchange', 1) || $_POST['cancel']) + if ($GLOBALS['egw']->acl->check('nopasswordchange', 1)) { - egw_framework::window_close(); + egw_framework::window_close('There was no password change!'); } - - $GLOBALS['egw']->template->set_file(array( - 'form' => 'changepassword.tpl' - )); - $GLOBALS['egw']->template->set_var('lang_enter_password',lang('Enter your new password')); - $GLOBALS['egw']->template->set_var('lang_reenter_password',lang('Re-enter your password')); - $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',egw::link('/index.php','menuaction=preferences.preferences_password.change')); - - $errors = array(); - if($_POST['change']) + + if (!is_array($content)) { - $o_passwd = $GLOBALS['egw_info']['user']['passwd']; - - if($o_passwd != $o_passwd_2) + $content= array(); + } + else + { + if ($content['button']['change']) { - $errors[] = lang('The old password is not correct'); - } - - if($n_passwd != $n_passwd_2) - { - $errors[] = lang('The two passwords are not the same'); - } - - if($o_passwd == $n_passwd) - { - $errors[] = lang('Old password and new password are the same. This is invalid. You must enter a new password'); - } - - if(!$n_passwd) - { - $errors[] = lang('You must enter a password'); - } - - // allow auth backends or configured password strenght to throw exceptions and display there message - if (!$errors) - { - try { - $passwd_changed = $GLOBALS['egw']->auth->change_password($o_passwd, $n_passwd, - $GLOBALS['egw_info']['user']['account_id']); - } - catch (Exception $e) { - $errors[] = $e->getMessage(); - } - } - if(!$passwd_changed) - { - if (!$errors) // if we have no specific error, add general message + $o_passwd = $GLOBALS['egw_info']['user']['passwd']; + if($o_passwd != $content['o_passwd_2']) { - $errors[] = lang('Failed to change password.'); + $errors[] = lang('The old password is not correct'); } - egw_framework::message(implode("\n", $errors), 'error'); - common::egw_header(); - echo parse_navbar(); - $GLOBALS['egw']->template->pfp('out','form'); - common::egw_exit(True); - } - else - { - egw_framework::refresh_opener(lang('Password changed'), 'preferences'); - egw_framework::window_close(); + if($content['n_passwd'] != $content['n_passwd_2']) + { + $errors[] = lang('The two passwords are not the same'); + } + + if($o_passwd == $content['n_passwd']) + { + $errors[] = lang('Old password and new password are the same. This is invalid. You must enter a new password'); + } + + if(!$content['n_passwd']) + { + $errors[] = lang('You must enter a password'); + } + + // allow auth backends or configured password strenght to throw exceptions and display there message + if (!$errors) + { + try { + $passwd_changed = $GLOBALS['egw']->auth->change_password($o_passwd, $content['n_passwd'], + $GLOBALS['egw_info']['user']['account_id']); + } + catch (Exception $e) { + $errors[] = $e->getMessage(); + } + } + if(!$passwd_changed) + { + if (!$errors) // if we have no specific error, add general message + { + $errors[] = lang('Failed to change password.'); + } + egw_framework::message(implode("\n", $errors), 'error'); + $content = array(); + } + else + { + 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->pfp('out','form'); - common::egw_footer(); + $GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password'); + $tmpl = new etemplate_new('preferences.password'); + + $tmpl->exec('preferences.preferences_password.change', $content,array(),array(),array(),2); } } diff --git a/preferences/templates/default/app.css b/preferences/templates/default/app.css index 04b1d6d9f0..ceebb13bc8 100644 --- a/preferences/templates/default/app.css +++ b/preferences/templates/default/app.css @@ -48,4 +48,7 @@ tr.prefRow:hover .prefHelp { font-size: 150%; margin-top: 10px; margin-right: 5px; +} +#preferences-password .dialogHeader td { + text-align: center; } \ No newline at end of file diff --git a/preferences/templates/default/password.xet b/preferences/templates/default/password.xet new file mode 100644 index 0000000000..ad9967e8f0 --- /dev/null +++ b/preferences/templates/default/password.xet @@ -0,0 +1,43 @@ + + + + + + diff --git a/preferences/templates/pixelegg/app.css b/preferences/templates/pixelegg/app.css index f5ce7940f1..d8c9881a38 100755 --- a/preferences/templates/pixelegg/app.css +++ b/preferences/templates/pixelegg/app.css @@ -66,6 +66,9 @@ textarea.prefValue { margin-top: 10px; margin-right: 5px; } +#preferences-password .dialogHeader td { + text-align: center; +} /* ############################################################################# // iframe // Rahmen + padding**/ @@ -100,7 +103,7 @@ tr.prefRow > td { /* otherwise help will cover bigger prefValue */ } .prefHelp { - position: fixed; + position: absolute; background-color: #e6e6e6; /*border-radius: 10px;*/ -webkit-box-shadow: 1px 2px 1px rgba(0, 0, 0, 0.5); @@ -188,7 +191,6 @@ div#preferences-settings { } div#preferences-settings div.dialogHeader { height: 50px; - font-size: 100% !important; } div#preferences-settings div.dialogHeader select#preferences-settings_appname { min-width: 47%;