PLUGIN :: Dirty fix for changing passwords.

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

PLUGIN :: Dirty fix for changing passwords.

Post by Alice »

Install as any ordinary plugin
Console -> user management -> click on user and thick the "User is allowed to change password" box.

* Tested on linux ONLY but should work on windows too.

I'm waiting for comments :)
Attachments
passwd.png
passwd.png (47.59 KiB) Viewed 25430 times
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

Post by Alice »

WHY no one told me that I forgot to attach the plugin? :-?

CAN SOMEONE PLEASE ALLOW THE TGZ EXTENSION FOR ATTACHED FILES?
Attachments
passwd.zip
(11.32 KiB) Downloaded 1180 times
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

tar.Z and tar.gz are allowed
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

How about making this a link on the side - or an addition to a settings page or something other than a tab?
User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

Post by Alice »

It's mainly for customers. They don't have access to console or settings on my server :). Actually, all they can see is the 'graphs' tab.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
akashah
Posts: 29
Joined: Mon May 29, 2006 10:36 pm
Location: Malaysia

Post by akashah »

Hi everyone,

I get this error when i try to test this addons. What it is means and how can i fix it?

Notice: Undefined index: passwd.php:changepassword in /var/www/localhost/htdocs/cacti/lib/functions.php on line 1357

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/cacti/include/top_graph_header.php:80) in /var/www/localhost/htdocs/cacti/plugins/passwd/passwd.php on line 28
User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

Post by Alice »

I've just tried it on another server and it works perfectly.
Sorry, can't help you :(
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
Darck
Posts: 7
Joined: Tue Jan 31, 2006 4:26 am

Post by Darck »

akashah wrote:Hi everyone,

I get this error when i try to test this addons. What it is means and how can i fix it?

Notice: Undefined index: passwd.php:changepassword in /var/www/localhost/htdocs/cacti/lib/functions.php on line 1357

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/cacti/include/top_graph_header.php:80) in /var/www/localhost/htdocs/cacti/plugins/passwd/passwd.php on line 28
Your error_reporting level is too high. That's why you see notices (and breaking the redirection...)

Try adding ini_set("error_reporting", 2039); at the top of your functions.php file.
akashah
Posts: 29
Joined: Mon May 29, 2006 10:36 pm
Location: Malaysia

Post by akashah »

Hi Darck,

Thanks for the advice. I think it work. This error "Notice: Undefined index: passwd.php:changepassword in /var/www/localhost/htdocs/cacti/lib/functions.php on line 1357" dont appear any more. Only this error still appear.

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/cacti/include/top_graph_header.php:80) in /var/www/localhost/htdocs/cacti/plugins/passwd/passwd.php on line 28

Do you have any solution to fix this error?
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Works for me. We have resolve the issue in 0.9, but this is good for now.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

for this error :
Notice: Undefined index: passwd.php:changepassword in /var/www/localhost/htdocs/cacti/lib/functions.php on line 1357

change function passwd_draw_navigation_text in setup.php :

Code: Select all

function passwd_draw_navigation_text ($nav) {
$nav["passwd.php:"] = array("title" => "Change Password", "mapping" => "", "url" => "passwd.php", "level" => "1");
$nav["passwd.php:changepassword"] = array("title" => "Change Password", "mapping" => "", "url" => "passwd.php", "level" => "1");
return $nav;
}
you miss one line
Last edited by gilles on Sat Jul 22, 2006 5:36 pm, edited 2 times in total.
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

for this error :

Warning: Cannot modify header information - headers already sent

use this modified code in passwd.php, line 21 :

Code: Select all

kill_session_var("sess_change_password");
/*			
$realm_id = $user_auth_realm_filenames["index.php"];
if (sizeof(db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id = '" . $_SESSION["sess_user_id"] . "' and user_auth_realm.realm_id = '" . $realm_id . "'")) > 0) {
switch ($user["login_opts"]) {
Case '1':
header("Location: " . $_POST["ref"]); break;
case '2':
header("Location: index.php"); break;
Case '3':
header("Location: graph_view.php"); break;
}
}else{
header("Location: graph_view.php"); 
}
*/
print "<br><br><center><strong><font color=\"#FF0000\">*** Password has been changed ! ***</font></strong><br><br>";
exit;
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

knobdy wrote:How about making this a link on the side - or an addition to a settings page or something other than a tab?
i have set it in "Utilities" :

1. in "passwd.php", you need to modify line 4 :

Code: Select all

include("./include/top_graph_header.php");
with :

Code: Select all

include_once("./include/top_header.php");

2. in "setup.php" :
put // before lines 4 and 5

Code: Select all

//$plugin_hooks['top_header_tabs']['passwd'] = 'passwd_show_tab';
//$plugin_hooks['top_graph_header_tabs']['passwd'] = 'passwd_show_tab';
replace function "passwd_config_arrays", near line 30 with :

Code: Select all

function passwd_config_arrays () {
global $user_auth_realms, $user_auth_realm_filenames, $menu;
$user_auth_realms[205]='User is allowed to change password';
$user_auth_realm_filenames['passwd.php'] = 205;
$temp = $menu["Utilities"]['logout.php'];
unset($menu["Utilities"]['logout.php']);
$menu["Utilities"]['plugins/passwd/passwd.php'] = "Change password";
$menu["Utilities"]['logout.php'] = $temp;	
}
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

this is my modified version :

EDIT:
link removed for version 0.1
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

http://gilles.boulon.free.fr/passwd/pas ... ed-0.2.zip

i correct a small bug : now you won't be prompted to change your password if you are not logged in Cacti with local user but instead use LDAP authentification.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests