Skip to content

Commit af3ee14

Browse files
committed
Yahooo, sync with devel server :)
1 parent d25ae72 commit af3ee14

File tree

94 files changed

+2971
-298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2971
-298
lines changed

web/change_password.php

Lines changed: 202 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,226 @@
11
<?php
22

33

4-
/**
5-
* Change password functionality
6-
*/
4+
define('VESTA_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
5+
define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vesta' . DIRECTORY_SEPARATOR);
6+
7+
require_once V_ROOT_DIR . 'config/Config.class.php';
8+
require_once V_ROOT_DIR . 'core/utils/Utils.class.php';
9+
require_once V_ROOT_DIR . 'core/VestaSession.class.php';
10+
require_once V_ROOT_DIR . 'core/Vesta.class.php';
11+
require_once V_ROOT_DIR . 'core/exceptions/SystemException.class.php';
12+
require_once V_ROOT_DIR . 'core/exceptions/ProtectionException.class.php';
13+
require_once V_ROOT_DIR . 'core/utils/Message.class.php';
14+
require_once V_ROOT_DIR . 'core/Request.class.php';
15+
require_once V_ROOT_DIR . 'api/AjaxHandler.php';
16+
17+
718
class ChangePassword
819
{
920

1021
public function dispatch()
1122
{
12-
//print_r($_SERVER);
1323
if (empty($_GET['v'])) {
1424
return $this->renderError('General error');
1525
}
1626

17-
$key = $_GET['v'];
18-
$real_key = sha1($_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR']);
19-
$key_sha1 = substr($key, 0, 10) . substr($key, 20, strlen($key));
20-
$stamp = substr($key, 10, 10);
21-
$allowed = time() - 60 * 5; // - 5 mins
22-
23-
if (strcmp($real_key, $key_sha1) != 0) {
27+
$key = addslashes(htmlspecialchars($_GET['v']));
28+
29+
$users = Vesta::execute(Vesta::V_LIST_SYS_USERS, 'json');
30+
$email_matched_count = array();
31+
32+
/*if (strcmp($real_key, $key_sha1) != 0) {
2433
return $this->renderError('Invalid keys');
34+
}*/
35+
36+
foreach ($users['data'] as $username => $user) {
37+
if ($user['RKEY'] == trim($key)) {
38+
$email_matched_count[] = array_merge(array('USERNAME' => $username), $user);
39+
}
40+
}
41+
42+
if (isset($_POST['action']) && $_POST['action'] == 'change') {
43+
return $this->doChangePassword($email_matched_count);
2544
}
2645

27-
/*if ($stamp < $allowed) {
28-
return $this->renderError('Key is expired');
29-
}*/
46+
return $this->showResetForm();
47+
}
48+
49+
protected function doChangePassword($users)
50+
{
51+
if ($_POST['secret_code'] != $_POST['confirm_secret_code']) {
52+
return $this->showResetForm('Passwords don\'t match');
53+
}
54+
55+
if (strlen($_POST['secret_code']) < 6) {
56+
return $this->showResetForm('Passwords is too short');
57+
}
58+
59+
if (strlen($_POST['secret_code']) > 255) {
60+
return $this->showResetForm('Passwords is too long');
61+
}
3062

31-
$this->showResetForm();
32-
print $key_sha1 . "<br />" . $real_key;
63+
$success = true;
64+
foreach ($users as $user) {
65+
$rs = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD, array('USER' => $user['USERNAME'],
66+
'PASSWORD' => $_POST['secret_code']));
67+
if (!$rs) {
68+
$success = false;
69+
}
70+
}
71+
72+
if (!$success) {
73+
return $this->showResetForm('Something went wrong. Please contact support.');
74+
}
75+
76+
return $this->showSuccessTpl();
3377
}
3478

35-
public function showResetForm()
79+
public function showSuccessTpl()
3680
{
3781
print <<<HTML
38-
<form action="" >
39-
<input type="hidden" name="action" value="change" />
40-
<label>Enter secret code:</label>
41-
<input type="text" name="secret_code" value="" />
42-
<label>Enter new password:</label>
43-
<input type="text" name="secret_code" value="" />
82+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
83+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
84+
<head>
85+
<title>Vesta Control Panel</title>
86+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
87+
<meta http-equiv="imagetoolbar" content="false" />
88+
89+
<link rel="shortcut icon" href="images/fav.ico" type="image/x-icon">
90+
<link rel="stylesheet" media="all" type="text/css" href="css/reset2.css" />
91+
<link rel="stylesheet" media="all" type="text/css" href="css/main.css" />
92+
<link rel="stylesheet" media="all" type="text/css" href="css/vesta-login-form.css" />
93+
94+
<!--[if lt IE 8]>
95+
<link rel="stylesheet" type="text/css" href="http://dl.dropbox.com/u/1750887/projects/vesta2/css/ie.css" />
96+
<![endif]-->
97+
</head>
98+
99+
<body class="page-auth">
100+
<div id="change-psw-block" class="page2">
101+
<div class="b-auth-form">
102+
<div class="b-auth-form-wrap">
103+
<img width="72" height="24" alt="" src="/images/vesta-logo-2011-12-14.png" class="vesta-logo">
104+
<span style="color: #5E696B; float: right; margin-top: -48px;">~!:VERSION~!</span>
105+
<div class="b-client-title">
106+
<span class="client-title-wrap">Control Panel<i class="planets">&nbsp;</i></span>
107+
</div>
108+
<form id="change_psw-form" method="post" action="" class="auth">
109+
<input type="hidden" value="change" name="action">
110+
111+
<div class="success-box" id="change-psw-success">Password successfully changed.</div>
112+
113+
</form>
114+
<p class="forgot-pwd">&nbsp;</p>
115+
<div class="footnotes cc">
116+
<p class="additional-info">For questions please contact <a href="mailto:info@vestacp.com" class="questions-url">info@vestacp.com</a></p>
117+
<address class="imprint">&copy; 2011 Vesta Control Panel</address>
118+
</div>
119+
</div>
120+
</div>
121+
</div>
122+
</body>
123+
</html>
124+
125+
HTML;
126+
127+
}
128+
129+
public function showResetForm($error_msg = '')
130+
{
131+
if (!empty($error_msg)) {
132+
$error_msg = '<i>'.$error_msg.'</i>';
133+
}
134+
135+
print <<<HTML
136+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
137+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
138+
<head>
139+
<title>Vesta Control Panel</title>
140+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
141+
<meta http-equiv="imagetoolbar" content="false" />
142+
143+
<link rel="shortcut icon" href="images/fav.ico" type="image/x-icon">
144+
<link rel="stylesheet" media="all" type="text/css" href="css/reset2.css" />
145+
<link rel="stylesheet" media="all" type="text/css" href="css/main.css" />
146+
<link rel="stylesheet" media="all" type="text/css" href="css/vesta-login-form.css" />
147+
148+
<!--[if lt IE 8]>
149+
<link rel="stylesheet" type="text/css" href="http://dl.dropbox.com/u/1750887/projects/vesta2/css/ie.css" />
150+
<![endif]-->
151+
</head>
152+
153+
<body class="page-auth">
154+
<div id="change-psw-block" class="page2">
155+
<div class="b-auth-form">
156+
<div class="b-auth-form-wrap">
157+
<img width="72" height="24" alt="" src="/images/vesta-logo-2011-12-14.png" class="vesta-logo">
158+
<span style="color: #5E696B; float: right; margin-top: -48px;">~!:VERSION~!</span>
159+
<div class="b-client-title">
160+
<span class="client-title-wrap">Control Panel<i class="planets">&nbsp;</i></span>
161+
</div>
162+
<form id="change_psw-form" method="post" action="" class="auth">
163+
<input type="hidden" value="change" name="action">
164+
165+
<div class="form-row cc">
166+
<label for="password" class="field-label">New Password</label>
167+
<input type="password" tabindex="1" id="password" class="field-text" name="secret_code">
168+
</div>
169+
170+
<div class="form-row cc">
171+
<label for="confirm_password" class="field-label">ONE MORE TIME</label>
172+
<input type="password" tabindex="1" id="confirm_password" class="field-text" name="confirm_secret_code">
173+
</div>
174+
175+
<div class="form-row cc last-row">
176+
<input type="submit" tabindex="4" value="Change Password" class="sumbit-btn">
177+
</div>
178+
</form>
179+
<p class="forgot-pwd">&nbsp;</p>
180+
<div class="footnotes cc">
181+
<p class="additional-info">For questions please contact <a href="mailto:info@vestacp.com" class="questions-url">info@vestacp.com</a></p>
182+
<address class="imprint">&copy; 2011 Vesta Control Panel</address>
183+
</div>
184+
</div>
185+
</div>
186+
</div>
187+
</body>
188+
</html>
189+
190+
<!--
191+
192+
<center>
193+
vesta password reset form
194+
<hr />
195+
{$error_msg}
196+
<form action="" method="POST">
197+
<table>
198+
<tr>
199+
<td>
200+
<input type="hidden" name="action" value="change" />
201+
<label>Enter secret code:</label>
202+
</td>
203+
<td>
204+
<input type="password" name="secret_code" value="" />
205+
</td>
206+
</tr>
207+
<tr>
208+
<td>
209+
<label>Enter new password:</label>
210+
</td>
211+
<td>
212+
<input type="password" name="confirm_secret_code" value="" />
213+
</td>
214+
</tr>
215+
<tr>
216+
<td colspan="2">
217+
<input type="submit" name="Apply" />
218+
</td>
219+
</tr>
220+
</table>
44221
</form>
222+
</center> -->
223+
45224
HTML;
46225

47226
}

web/css/main.css

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,12 @@ input::-moz-focus-inner{
305305
color:#000;
306306
}
307307
.primary-nav .active .section-inner{
308-
cursor:default;
308+
cursor:pointer;
309309
}
310310
.primary-nav .active .section-devider{
311-
background-position:-140px 100%;
312-
height:5px;
313-
bottom:-2px;
311+
background-position:-283px 100%;
312+
height:6px;
313+
bottom:-3px;
314314
}
315315
.primary-nav .active .def{
316316
color:#8c9c91;
@@ -1777,7 +1777,7 @@ input::-moz-focus-inner{
17771777
*display: inline;
17781778

17791779
margin-left:30px;
1780-
font-size:12px;
1780+
font-size:11px;
17811781
line-height:1;
17821782
font-weight:bold;
17831783

@@ -1797,14 +1797,14 @@ input::-moz-focus-inner{
17971797

17981798
.b-new-entry .delete-btn{
17991799
position:absolute;
1800-
top:15px;
1800+
top:18px;
18011801
right:16px;
18021802

1803-
font-size:12px;
1804-
line-height:14px;
1803+
font-size:9px;
1804+
line-height:11px;
18051805
text-transform:uppercase;
18061806
color:#333;
1807-
letter-spacing:2px;
1807+
letter-spacing:3px;
18081808
cursor:pointer;
18091809
border-bottom:1px solid #ff6766;
18101810
}
@@ -3118,8 +3118,36 @@ input::-moz-focus-inner{
31183118
background-image:url(../images/stats-curve-grey.png);
31193119
}
31203120

3121-
.success-box {border: 1px dashed #BBBF45;color: #BBBF45;}
3121+
.success-box {
3122+
color: #BBBF45;
3123+
font-size: 22px;
3124+
padding-left: 136px;
3125+
padding-bottom: 30px;
3126+
}
31223127

31233128
.inactive-row { font-style: italic; opacity: 0.38; background: url('../images/bg_line.png');filter: alpha(opacity = 38); }
31243129
.form-suspended input[type="text"], .form-suspended input[type="checkbox"], .form-suspended .checkbox, .form-suspended select, .form-suspended textarea, .form-suspended .select { opacity: 0.38;filter: alpha(opacity = 38); }
31253130
.form-suspended .do_action_toggle_suspend {opacity: 1; filter: alpha(opacity = 100);}
3131+
3132+
3133+
.stats-block{
3134+
background:#474338;
3135+
padding:10px;
3136+
width:600px;
3137+
margin:0 auto 10px;
3138+
}
3139+
.stats-block-header{
3140+
color:#fc0;
3141+
font-size:12px;
3142+
font-weight:bold;
3143+
text-align:center;
3144+
}
3145+
.stats-block .stats-graph{
3146+
display:block;
3147+
margin:0 auto;
3148+
}
3149+
3150+
/* START: DEV!! */
3151+
.stats-subbar {cursor: pointer;}
3152+
.stats-subbar .sub-active{font-weight: bold;}
3153+
/* END: DEV */

web/css/main2.css

Whitespace-only changes.

web/css/vesta-login-form.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,16 @@
6868
}
6969
.page-auth .field-label{
7070
float:left;
71-
width:87px;
72-
padding-left:45px;
71+
width:101px;
72+
padding-left:15px;
73+
padding-right:17px;
7374
color:#e3d785;
7475
font-size:12px;
76+
font-weight:bold;
7577
line-height:34px;
7678
font-family:Arial, Helvetica, sans-serif;
7779
text-transform:uppercase;
80+
text-align:right;
7881
/*letter-spacing:-.5px;*/
7982
}
8083
.page-auth .field-text{
@@ -183,7 +186,7 @@
183186
margin:0 -20px;
184187
padding:15px 20px;
185188
font-size:14px;
186-
border-top:2px solid #34352f;
189+
border-top:1px solid #34352f;
187190
color:#5a5e5d;
188191
}
189192
.page-auth .footnotes .additional-info{

web/images/_fav.ico

1.05 KB
Binary file not shown.

web/images/auth/logo.png

2.71 KB
874 Bytes
1.21 KB
1.07 KB

web/images/backup-checkbox.png

1015 Bytes

0 commit comments

Comments
 (0)