-
Notifications
You must be signed in to change notification settings - Fork 0
/
setpass.php
65 lines (60 loc) · 2.55 KB
/
setpass.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* 重新设定密码
*
* 用户忘记密码后,先用取回密码功能,系统发送验证链接到用户email,用户收到后点击链接设定新密码
*
* 调用模板:/templates/setpass.html
*
* @category jieqicms
* @package system
* @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
* @author $Author: juny $
* @version $Id: setpass.php 344 2009-06-23 03:06:07Z juny $
*/
define('JIEQI_MODULE_NAME', 'system');
require_once('global.php');
jieqi_loadlang('users', JIEQI_MODULE_NAME);
if(empty($_REQUEST['id']) || empty($_REQUEST['checkcode'])) jieqi_printfail($jieqiLang['system']['no_checkcode_id']);
include_once(JIEQI_ROOT_PATH.'/class/users.php');
$users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
$user=$users_handler->get($_REQUEST['id']);
if(!is_object($user)) jieqi_printfail(LANG_NO_USER);
if(md5($user->getVar('pass')) != $_REQUEST['checkcode']) jieqi_printfail($jieqiLang['system']['error_checkcode']);
if (!isset($_REQUEST['action'])) $_REQUEST['action'] = 'setpass';
switch($_REQUEST['action']) {
case 'newpass':
$_REQUEST['uid'] = $_REQUEST['id'];
$_REQUEST['oldpass'] = $user->getVar('pass', 'n');
$_REQUEST['jumpurl'] = JIEQI_URL.'/login.php';
$_REQUEST['lang_failure'] = $jieqiLang['system']['set_password_failure'];
$_REQUEST['lang_success'] = $jieqiLang['system']['set_password_success'];
jieqi_useraction('edit', $_REQUEST);
$_REQUEST['pass'] = trim($_REQUEST['pass']);
$_REQUEST['repass'] = trim($_REQUEST['repass']);
$errtext='';
//检查密码
if (strlen($_REQUEST['pass'])==0 || strlen($_REQUEST['repass'])==0) $errtext .= $jieqiLang['system']['need_pass_repass'].'<br />';
elseif ($_REQUEST['pass'] != $_REQUEST['repass']) $errtext .= $jieqiLang['system']['password_not_equal'].'<br />';
if(empty($errtext)) {
$user->setVar('pass', $users_handler->encryptPass($_REQUEST['pass']));
$users_handler->insert($user);
jieqi_jumppage(JIEQI_USER_URL.'/login.php', LANG_DO_SUCCESS, $jieqiLang['system']['set_password_success']);
}else{
jieqi_printfail($errtext);
}
break;
case 'setpass':
default:
include_once(JIEQI_ROOT_PATH.'/header.php');
$jieqiTpl->assign('url_setpass', JIEQI_USER_URL.'/setpass.php?do=submit');
$jieqiTpl->assign('action', 'newpass');
$jieqiTpl->assign('id', $_REQUEST['id']);
$jieqiTpl->assign('checkcode', $_REQUEST['checkcode']);
$jieqiTpl->assign('username', $user->getVar('uname'));
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = JIEQI_ROOT_PATH.'/templates/setpass.html';
include_once(JIEQI_ROOT_PATH.'/footer.php');
break;
}
?>