root/trunk/gui/lostpassword.php

Revision 1327, 4.5 kB (checked in by rats, 3 weeks ago)

* Fixed: --scan-knownbad-files and --check-deleted are no longer supported by rkhunter
* Fixed #1471: chkrootkit should be in lenny / hardy
* Updated Chinese (simplified)
* Updated German
* Fixed #1475: typo on installation (ispcp-setup)
* Fixed: default user for rkhunter.log

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 require 'include/ispcp-lib.php';
22
23 if (!Config::get('LOSTPASSWORD')) {
24     system_message(tr('Retrieving lost passwords is currently not possible'));
25     die();
26 }
27
28 // check for gd >= 2.x
29 if (!check_gd()) {
30     system_message("ERROR: php-extension 'gd' not loaded !");
31 }
32
33 if (!captcha_fontfile_exists()) {
34     system_message("ERROR: captcha fontfile not found !");
35 }
36
37 // remove old uniqkeys
38 removeOldKeys(Config::get('LOSTPASSWORD_TIMEOUT'));
39
40 if (isset($_SESSION['user_theme'])) {
41     $theme_color = $_SESSION['user_theme'];
42 } else {
43     $theme_color = Config::get('USER_INITIAL_THEME');
44 }
45
46 if (isset($_GET['key'])) {
47     if ($_GET['key'] != "") {
48         check_input($_GET['key']);
49
50         $tpl = new pTemplate();
51         $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword_message.tpl');
52         $tpl->assign(
53                 array(
54                     'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'),
55                     'THEME_COLOR_PATH' => "themes/$theme_color",
56                     'THEME_CHARSET' => tr('encoding')
57                     )
58                 );
59
60         if (sendpassword($_GET['key'])) {
61             $tpl->assign(
62                     array(
63                         'TR_MESSAGE' => tr('Password sent'),
64                         'TR_LINK' => "<a class=\"link\" href=\"index.php\">" . tr('Login') . "</a>"
65                         )
66                     );
67         } else {
68             $tpl->assign(
69                     array(
70                         'TR_MESSAGE' => tr('ERROR: Password was not sent'),
71                         'TR_LINK' => "<a class=\"link\" href=\"index.php\">" . tr('Login') . "</a>"
72                         )
73                     );
74         }
75
76         $tpl->parse('PAGE', 'page');
77         $tpl->prnt();
78
79         if (Config::get('DUMP_GUI_DEBUG'))
80             dump_gui_debug();
81         exit(0);
82     }
83 }
84
85 if (isset($_POST['uname'])) {
86     check_ipaddr(getipaddr(), 'captcha');
87
88     if (($_POST['uname'] != "") && isset($_SESSION['image']) && isset($_POST['capcode'])) {
89         check_input(trim($_POST['uname']));
90         check_input($_POST['capcode']);
91
92         $tpl = new pTemplate();
93         $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword_message.tpl');
94         $tpl->assign(
95                 array(
96                     'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'),
97                     'THEME_COLOR_PATH' => "themes/$theme_color",
98                     'THEME_CHARSET' => tr('encoding')
99                     )
100                 );
101
102         if ($_SESSION['image'] == $_POST['capcode']) {
103             if (requestpassword($_POST['uname'])) {
104                 $tpl->assign(
105                         array(
106                             'TR_MESSAGE' => tr('The password was requested'),
107                             'TR_LINK' => "<a class=\"link\" href=\"index.php\">" . tr('Back') . "</a>"
108                             )
109                         );
110             } else {
111                 $tpl->assign(
112                         array(
113                             'TR_MESSAGE' => tr('ERROR: Unknown user'),
114                             'TR_LINK' => "<a class=\"link\" href=\"lostpassword.php\">" . tr('Retry') . "</a>"
115                             )
116                         );
117             }
118         } else {
119             $tpl->assign(
120                     array(
121                         'TR_MESSAGE' => tr('ERROR: Security code was not correct!') . ' ' . $_SESSION['image'],
122                         'TR_LINK' => "<a class=\"link\" href=\"lostpassword.php\">" . tr('Retry') . "</a>"
123                         )
124                     );
125         }
126
127         $tpl->parse('PAGE', 'page');
128         $tpl->prnt();
129
130         if (Config::get('DUMP_GUI_DEBUG'))
131             dump_gui_debug();
132         exit(0);
133     }
134 }
135
136 unblock(Config::get('BRUTEFORCE_BLOCK_TIME'), 'captcha');
137 is_ipaddr_blocked(null, 'captcha', true);
138
139 $tpl = new pTemplate();
140 $tpl->define('page', Config::get('LOGIN_TEMPLATE_PATH') . '/lostpassword.tpl');
141 $tpl->assign(
142             array(
143                 'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'),
144                 'THEME_COLOR_PATH' => Config::get('LOGIN_TEMPLATE_PATH'),
145                 'THEME_CHARSET' => tr('encoding'),
146                 'TR_CAPCODE' => tr('Security code'),
147                 'TR_IMGCAPCODE_DESCRIPTION' => tr('(To avoid abuse, we ask you to write the combination of letters on the above picture into the field "Security code")'),
148                 'TR_IMGCAPCODE' => "<img src=\"imagecode.php\" border=\"0\" nosave alt=\"\">",
149                 'TR_USERNAME' => tr('Username'),
150                 'TR_SEND' => tr('Request password'),
151                 'TR_BACK' => tr('Back')
152                 )
153             );
154
155 $tpl->parse('PAGE', 'page');
156 $tpl->prnt();
157
158 if (Config::get('DUMP_GUI_DEBUG'))
159     dump_gui_debug();
160
161 ?>
Note: See TracBrowser for help on using the browser.