📄 passwd.users.class.inc
字号:
<?php/*** @copyright Intermesh 2005* @author Merijn Schering <mschering@intermesh.nl>* @version $Revision: 1.5 $ $Date: 2005/11/04 16:16:17 $3 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ require_once($GO_CONFIG->class_path.'base/sql.users.class.inc'); /** * This is the passwd class of the user management class family * This class totaly relies on the SQL classes but only changes the system * password with: sudo /usr/sbin/chpasswd * * You need to give the Apache user permissions for chpasswd with visudo for * this to work. * * Example entry in /etc/sudoers in case the Apache username is apache: * * apache ALL=NOPASSWD:/usr/sbin/chpasswd * * NOPASSWD is required for this to work. * * @package Framework * @author Merijn Schering <mschering@intermesh.nl> * @since Group-Office 2.05 */ class passwd_users extends sql_users{ function passwd_users() { $this->sql_users(); } function update_password($user_id, $password) { global $GO_CONFIG; $sql = "UPDATE users SET password='".md5($password)."' WHERE id='$user_id'"; if ($this->query($sql)) { if($user = $this->get_user($user_id)) { if(isset($_SESSION['auth_source']) && $_SESSION['auth_source']['type'] == 'email') { $username = str_replace('@'.$_SESSION['auth_source']['domain'],'', $user['username']); global $GO_MODULES; if($_SESSION['auth_source']['user_manager'] == 'passwd' && $GO_MODULES->modules['email']) { if($_SESSION['auth_source']['add_domain_to_username']) { $mail_username = $user['username']; }else { $mail_username = $username; } require_once($GO_MODULES->modules['email']['class_path']."email.class.inc"); $email = new email(); $email->update_password($_SESSION['auth_source']['host'], $mail_username, $password); } }else { $username = $user['username']; } exec('echo '.$username.':'.$password.' | '.$GO_CONFIG->cmd_sudo.' '.$GO_CONFIG->cmd_chpasswd); return true; } } return false; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -