| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
require 'include/ispcp-lib.php'; |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
if (!$cfg['LOSTPASSWORD']) { |
|---|
| 24 |
system_message(tr('Retrieving lost passwords is currently not possible')); |
|---|
| 25 |
die(); |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
if (check_gd() == false) |
|---|
| 30 |
system_message("ERROR: php-extension 'gd' not loaded !"); |
|---|
| 31 |
|
|---|
| 32 |
if (captcha_fontfile_exists() == false) |
|---|
| 33 |
system_message("ERROR: captcha fontfile not found !"); |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
removeOldKeys($cfg['LOSTPASSWORD_TIMEOUT']); |
|---|
| 37 |
|
|---|
| 38 |
if (isset($_SESSION['user_theme'])) { |
|---|
| 39 |
$theme_color = $_SESSION['user_theme']; |
|---|
| 40 |
} else { |
|---|
| 41 |
$theme_color = $cfg['USER_INITIAL_THEME']; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
if (isset($_GET['key'])) { |
|---|
| 45 |
if ($_GET['key'] != "") { |
|---|
| 46 |
|
|---|
| 47 |
check_input($_GET['key']); |
|---|
| 48 |
|
|---|
| 49 |
$tpl = new pTemplate(); |
|---|
| 50 |
$tpl->define('page', $cfg['LOGIN_TEMPLATE_PATH'].'/lostpassword_message.tpl'); |
|---|
| 51 |
$tpl->assign(array( |
|---|
| 52 |
'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'), |
|---|
| 53 |
'THEME_COLOR_PATH' => "themes/$theme_color", |
|---|
| 54 |
'THEME_CHARSET' => tr('encoding') |
|---|
| 55 |
) |
|---|
| 56 |
); |
|---|
| 57 |
|
|---|
| 58 |
if (sendpassword($_GET['key'])) { |
|---|
| 59 |
$tpl->assign(array( |
|---|
| 60 |
'TR_MESSAGE' => tr('Password sent'), |
|---|
| 61 |
'TR_LINK' => "<a class=\"link\" href=\"index.php\">".tr('Login')."</a>" |
|---|
| 62 |
) |
|---|
| 63 |
); |
|---|
| 64 |
|
|---|
| 65 |
} else { |
|---|
| 66 |
$tpl->assign(array( |
|---|
| 67 |
'TR_MESSAGE' => tr('ERROR: Password was not sent'), |
|---|
| 68 |
'TR_LINK' => "<a class=\"link\" href=\"index.php\">".tr('Login')."</a>" |
|---|
| 69 |
) |
|---|
| 70 |
); |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
$tpl->parse('PAGE', 'page'); |
|---|
| 74 |
$tpl->prnt(); |
|---|
| 75 |
|
|---|
| 76 |
if ($cfg['DUMP_GUI_DEBUG']) dump_gui_debug(); |
|---|
| 77 |
exit(0); |
|---|
| 78 |
} |
|---|
| 79 |
} |
|---|
| 80 |
|
|---|
| 81 |
if (isset($_POST['uname'])) { |
|---|
| 82 |
|
|---|
| 83 |
check_ipaddr(getipaddr(), 'captcha'); |
|---|
| 84 |
|
|---|
| 85 |
if (($_POST['uname'] != "") AND isset($_SESSION['image']) AND isset($_POST['capcode'])) { |
|---|
| 86 |
|
|---|
| 87 |
check_input($_POST['uname']); |
|---|
| 88 |
check_input($_POST['capcode']); |
|---|
| 89 |
|
|---|
| 90 |
$tpl = new pTemplate(); |
|---|
| 91 |
$tpl -> define('page', $cfg['LOGIN_TEMPLATE_PATH'].'/lostpassword_message.tpl'); |
|---|
| 92 |
$tpl -> assign(array( |
|---|
| 93 |
'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'), |
|---|
| 94 |
'THEME_COLOR_PATH' => "themes/$theme_color", |
|---|
| 95 |
'THEME_CHARSET' => tr('encoding') |
|---|
| 96 |
) |
|---|
| 97 |
); |
|---|
| 98 |
|
|---|
| 99 |
if ($_SESSION['image'] == $_POST['capcode']) { |
|---|
| 100 |
if (requestpassword($_POST['uname'])) { |
|---|
| 101 |
$tpl -> assign(array( |
|---|
| 102 |
'TR_MESSAGE' => tr('The password was requested'), |
|---|
| 103 |
'TR_LINK' => "<a class=\"link\" href=\"index.php\">".tr('Back')."</a>" |
|---|
| 104 |
) |
|---|
| 105 |
); |
|---|
| 106 |
} else { |
|---|
| 107 |
$tpl -> assign(array( |
|---|
| 108 |
'TR_MESSAGE' => tr('ERROR: Unknown user'), |
|---|
| 109 |
'TR_LINK' => "<a class=\"link\" href=\"lostpassword.php\">".tr('Retry')."</a>" |
|---|
| 110 |
) |
|---|
| 111 |
); |
|---|
| 112 |
} |
|---|
| 113 |
} else { |
|---|
| 114 |
$tpl -> assign(array( |
|---|
| 115 |
'TR_MESSAGE' => tr('ERROR: Security code was not correct!').' '. $_SESSION['image'], |
|---|
| 116 |
'TR_LINK' => "<a class=\"link\" href=\"lostpassword.php\">".tr('Retry')."</a>" |
|---|
| 117 |
) |
|---|
| 118 |
); |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
$tpl -> parse('PAGE', 'page'); |
|---|
| 122 |
$tpl -> prnt(); |
|---|
| 123 |
|
|---|
| 124 |
if ($cfg['DUMP_GUI_DEBUG']) dump_gui_debug(); |
|---|
| 125 |
exit(0); |
|---|
| 126 |
} |
|---|
| 127 |
} |
|---|
| 128 |
|
|---|
| 129 |
unblock($cfg['BRUTEFORCE_BLOCK_TIME'], 'captcha'); |
|---|
| 130 |
is_ipaddr_blocked(null, 'captcha', true); |
|---|
| 131 |
|
|---|
| 132 |
$tpl = new pTemplate(); |
|---|
| 133 |
$tpl->define('page', $cfg['LOGIN_TEMPLATE_PATH'].'/lostpassword.tpl'); |
|---|
| 134 |
$tpl->assign( |
|---|
| 135 |
array( |
|---|
| 136 |
'TR_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Virtual Hosting Control System'), |
|---|
| 137 |
'THEME_COLOR_PATH' => $cfg['LOGIN_TEMPLATE_PATH'], |
|---|
| 138 |
'THEME_CHARSET' => tr('encoding'), |
|---|
| 139 |
'TR_CAPCODE' => tr('Security code'), |
|---|
| 140 |
'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")'), |
|---|
| 141 |
'TR_IMGCAPCODE' => "<img src=\"imagecode.php\" border=\"0\" nosave alt=\"\">", |
|---|
| 142 |
'TR_USERNAME' => tr('Username'), |
|---|
| 143 |
'TR_SEND' => tr('Request password'), |
|---|
| 144 |
'TR_BACK' => tr('Back') |
|---|
| 145 |
) |
|---|
| 146 |
); |
|---|
| 147 |
|
|---|
| 148 |
$tpl->parse('PAGE', 'page'); |
|---|
| 149 |
$tpl->prnt(); |
|---|
| 150 |
|
|---|
| 151 |
if ($cfg['DUMP_GUI_DEBUG']) dump_gui_debug(); |
|---|
| 152 |
|
|---|
| 153 |
?> |
|---|