/** * @throws UserIDMissingException */ public static function change_boolean_entry() { if ($_GET['id']) { $user = new User($_GET['id']); switch ($_GET['aspect']) { case "mc_password": if ($user->get_boolean_user_entry("must_change_password") == true) { $return = $user->set_boolean_user_entry("must_change_password", false); } else { $return = $user->set_boolean_user_entry("must_change_password", true); } break; case "cc_password": if ($user->get_boolean_user_entry("can_change_password") == true) { $return = $user->set_boolean_user_entry("can_change_password", false); } else { $return = $user->set_boolean_user_entry("can_change_password", true); } break; case "secure_password": if ($user->get_boolean_user_entry("secure_password") == true) { $return = $user->set_boolean_user_entry("secure_password", false); } else { $return = $user->set_boolean_user_entry("secure_password", true); } break; case "block_write": if ($user->get_boolean_user_entry("block_write") == true) { $return = $user->set_boolean_user_entry("block_write", false); } else { $return = $user->set_boolean_user_entry("block_write", true); } break; case "create_folder": if ($user->get_boolean_user_entry("create_folder") == true) { $return = $user->set_boolean_user_entry("create_folder", false); } else { $return = $user->set_boolean_user_entry("create_folder", true); } break; case "user_locked": if ($user->get_boolean_user_entry("user_locked") == true) { $return = $user->set_boolean_user_entry("user_locked", false); } else { $return = $user->set_boolean_user_entry("user_locked", true); } break; case "user_inactive": if ($user->get_boolean_user_entry("user_inactive") == true) { $return = $user->set_boolean_user_entry("user_inactive", false); } else { $return = $user->set_boolean_user_entry("user_inactive", true); } break; } $paramquery = $_GET; $paramquery['action'] = "detail"; $params = http_build_query($paramquery, '', '&'); if ($return == true) { Common_IO::step_proceed($params, "Change Value", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Change Value", "Operation Failed", null); } } else { throw new UserIDMissingException(); } }
/** * @see AuthInterface::forgot_password() * @param string $username * @param string $name * @return bool */ public function forgot_password($username, $mail) { if ($username and $mail) { $system_log = new SystemLog(null); if (User::exist_username($username)) { $user_id = User::get_user_id_by_username($username); $user = new User($user_id); if ($user->check_mail(strtolower($mail))) { if ($user->get_boolean_user_entry("user_inactive") == false) { $new_password = User::generate_password(); $mail = new Mail(); $mail->set_recipient($user_id); $mail->set_subject("Your New Open-LIMS Password"); $mail->set_text("Your new password: "******"must_change_password", true); // Password sended successfully $system_log->create($user_id, 1, 1, "Password Send", "Forgot Password", "auth.php", null, null); return true; } else { // Error via sending throw new AuthForgotPasswordSendFailedException("", 0); } } else { // Inactive User $system_log->create($user_id, 1, 1, "Inactive User", "Forgot Password", "auth.php", null, null); throw new AuthUserNotFoundException("", 0); } } else { // Wrong E-Mail $system_log->create($user_id, 1, 0, "Wrong E-Mail", "Forgot Password", "auth.php", null, null); throw new AuthUserNotFoundException("", 0); } } else { // User Not Found $system_log->create(null, 1, 0, "User \"" . $username . "\" Not Found", "Forgot Password", "auth.php", null, null); throw new AuthUserNotFoundException("", 0); } } else { throw new AuthUserNotFoundException("", 0); } }