代码改变世界

管理员手工更改mantis用户密码

2013-03-14 11:50  Patrick.Lee  阅读(538)  评论(0编辑  收藏  举报

管理员手工更改mantis用户密码

        mantis管理员重置用户密码时,用户密码更改连接会发往用户的信箱中。但如果此时用户信箱无法使用,则用户将无法登陆mantis,影响工作。mantis没有提供管理员手工设置用户口令的功能,但查阅资料,可以为mantis增加该项功能,使mantisg管理员管理起来更方便。具体步骤如下:

       1. 修改文件 manage_user_edit_page.php

            1) 找到该行:"<!-- Email -->

            2) 粘贴下面代码:

<!-- Password -->
<tr <?php echo helper_alternate_class( 1 ) ?>>
<td class="category" width="30%">
<?php echo "Password (change only)" ?>:
</td>
<td width="70%">
<input type="text" size="16" maxlength="100" name="password" value="" />
</td>
</tr>

       2. 修改文件 manage_user_update.php

            1) 找到该行: $f_user_id = gpc_get_int( 'user_id' );

            2) 在该行下粘贴下面行:$f_pass = gpc_get_string('password');

            3) 找到该行: $result = db_query( $query );  有的版本是:$result = db_query_bound( $query, $query_params );

            4) 在该行上面粘贴下面行:

//Reset the password if specified.

if ($f_pass) user_set_password($f_user_id, $f_pass);

      3. 使用管理员身份administrator用户登陆,点击:  管理--->用户管理--->选择某用户,见下面界面: