让后台管理员修改密码时自动邮件提醒

让ecshop后台管理员修改密码时自动邮件提醒,合适团队后台管理人员较多的情况,让管理员改密码时候收到邮件提醒。功能强大简洁,比较人性化的一种修改方式

一、执行SQL,注意默认表前缀“ecs_”。

1

2

INSERT INTO `ecs_mail_templates` (`template_code`, `is_html`, `template_subject`, `template_content`, `last_modify`, `last_send`,`type`) VALUES

('modify_admin_password', 1, '管理员密码修改通知', '

{$user_name}:
\n
\n您的密码已修改,请妥善保管!忘记密码,请点击重置。 
\n
\n{$shop_name}
\n{$send_time}

', 0, 0, 'template');

二、编辑/admin/privilege.php

1

2

3

4

5

6

7

8

9

10

11

12

13

14
15
16
17
18
19
20
21
22
23
24
25
26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

//更新管理员信息

if($pwd_modified)

{

$sql = "UPDATE " .$ecs->table('admin_user'). " SET ".

"user_name = '$admin_name', ".

"email = '$admin_email', ".

"ec_salt = '$ec_salt' ".

$action_list.

$role_id.

$password.

$nav_list.

"WHERE user_id = '$admin_id'";
$db->query($sql);
//发送邮件
$template = get_mail_template('modify_admin_password');
$reset_pwd_url = $ecs->url() . ADMIN_PATH . '/get_password.php?act=forget_pwd';
$smarty->assign('user_name', $admin_name);
$smarty->assign('reset_pwd_url', $reset_pwd_url);
$smarty->assign('shop_name', $_CFG['shop_name']);
$smarty->assign('send_time', local_date($_CFG['time_format']));
$content = $smarty->fetch('str:' . $template['template_content']);
send_mail($admin_name, $admin_email, $template['template_subject'], $content, $template['is_html']);

}

else

{

$sql = "UPDATE " .$ecs->table('admin_user'). " SET ".

"user_name = '$admin_name', ".

"email = '$admin_email' ".

$action_list.

$role_id.

$nav_list.

"WHERE user_id = '$admin_id'";
$db->query($sql);

}

/* 记录管理员操作 */

admin_log($_POST['user_name'], 'edit', 'privilege');

三、编辑/languages/zh_cn/admin/mail_template.php,添加语言项

1

$_LANG['modify_admin_password'] = '管理员密码修改通知模板';

(0)

相关推荐