| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
?> |
|---|