$GLOBALS['phpgw']->template->set_var('lang_enter_password', lang('Enter your new password')); $GLOBALS['phpgw']->template->set_var('lang_reenter_password', lang('Re-enter your password')); $GLOBALS['phpgw']->template->set_var('lang_change', lang('Change')); $GLOBALS['phpgw']->template->set_var('lang_cancel', lang('Cancel')); $GLOBALS['phpgw']->template->set_var('form_action', $GLOBALS['phpgw']->link('/preferences/changepassword.php')); if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap') { $GLOBALS['phpgw']->template->set_var('sql_message', lang('note: This feature does *not* change your email password. This will ' . 'need to be done manually.')); } if (isset($_POST['change']) && $_POST['change']) { $errors = array(); if ($n_passwd != $n_passwd_2) { $errors[] = lang('The two passwords are not the same'); } else { $account = new phpgwapi_user(); try { $account->validate_password($n_passwd); } catch (Exception $e) { $errors[] = $e->getMessage(); // trigger_error($e->getMessage(), E_USER_WARNING); } } if (!$n_passwd) { $errors[] = lang('You must enter a password'); } if (count($errors)) { $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); $GLOBALS['phpgw']->template->set_var('messages', $GLOBALS['phpgw']->common->error_list($errors)); $GLOBALS['phpgw']->template->pfp('out', 'form'); $GLOBALS['phpgw']->common->phpgw_exit(True); }
/** * Validate the data for the admin user account * * @param string &$username the login id for the admin user - * @param string $passwd the password for the new user * @param string $passwd2 the verification password for the new user * @param string $fname the first name of the administrator * @param string $lname the lastname of the administrator * * @return array list of errors - empty array if valid * * @internal we pass the username by ref so it can be unset if invalid */ function validate_admin(&$username, $passwd, &$passwd2, $fname, $lname) { phpgw::import_class('phpgwapi.globally_denied'); $errors = array(); if ($passwd != $passwd2) { $errors[] = lang('Passwords did not match, please re-enter'); } else { $account = new phpgwapi_user(); try { $account->validate_password($passwd); } catch (Exception $e) { $errors[] = $e->getMessage(); } } if (!$username) { $errors[] = lang('You must enter a username for the admin'); } else { if (phpgwapi_globally_denied::user($username)) { $errors[] = lang('You can not use %1 as the admin username, please try again with another username', $username); $username = ''; } } return $errors; }
function lostpw3() { $r_reg = phpgw::get_var('r_reg'); $lid = $GLOBALS['phpgw']->session->appsession('loginid', 'registration'); if (!$lid) { $error[] = lang('Wrong session'); } if ($r_reg['passwd'] != $r_reg['passwd_2']) { $errors[] = lang('The two passwords are not the same'); } if (!$r_reg['passwd']) { $errors[] = lang('You must enter a password'); } else { $account = new phpgwapi_user(); try { $account->validate_password($r_reg['passwd']); } catch (Exception $e) { $errors[] = $e->getMessage(); } } if (!is_array($errors)) { $so = createobject('registration.soreg'); $so->lostpw3($lid, $r_reg['passwd']); } $ui = createobject('registration.uireg'); if (is_array($errors)) { $ui->lostpw3($errors, $r_reg, $lid); } else { $ui->lostpw4(); } return True; }