Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Commit 5c5d817

Browse files
committed
2 parents a15b8d7 + a634a51 commit 5c5d817

8 files changed

Lines changed: 44 additions & 15 deletions

File tree

app/controller/usercontroller.ctrl.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ public function login(){
5656
}
5757
$this->set('waste_bar_chart_stats', array_reverse($wstats, true));
5858

59+
if($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_GET)){
60+
$reset_result = $_GET['reset'];
61+
62+
if (!empty($reset_result) && $reset_result == 'ok') {
63+
$response['success'] = '<strong>Password reset successfully</strong>. You can now login with your new password.';
64+
65+
$this->set('response', $response);
66+
}
67+
}
68+
5969
if($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST)){
6070

6171
$response = array();
@@ -140,10 +150,16 @@ public function recover(){
140150
$this->User->update($data, $id);
141151

142152
// send email to User
143-
$message = "You've requested to recover your password for <strong>" . APPNAME . "</strong>.<br />
144-
Please click on this link to recover your password: <a href=\"" . BASE_URL . "/user/reset/?recovery=" . $data['recovery'] . "\">" . BASE_URL . "/user/reset/?recovery=" . $data['recovery'] . "</a>. <br />
145-
If the link doesn't work, please copy and paste it in the address bar of your browser.<br />
146-
The link will be active for the next 24 hours.";
153+
$message = "<p>Hi,</p>" .
154+
"<p>You've requested to recover your password for the " . APPNAME . ".</p>" .
155+
"<hr/>" .
156+
"<p>Please click on this link to recover your password: <a href=\"" . BASE_URL . "/user/reset/?recovery=" . $data['recovery'] . "\">" . BASE_URL . "/user/reset/?recovery=" . $data['recovery'] . "</a>.</p>" .
157+
"<p>If the link doesn't work, please copy and paste it in the address bar of your browser.</p>" .
158+
"<p>The link will be active for the next 24 hours.</p>" .
159+
"<hr/>" .
160+
"<p>If you have any issues, or if you did <strong>not</strong> ask to recover your password, please contact <a href='mailto:" . SUPPORT_CONTACT_EMAIL . "'>" . SUPPORT_CONTACT_EMAIL . "</a>.</p>" .
161+
"<p>Thanks for using the " . APPNAME . "!</p>" .
162+
"<p><em>The Restart Project</em></p>";
147163
$subject = APPNAME . ": Password recovery";
148164
$headers = "From: " . APPEMAIL . "\r\n";
149165
$headers .= "MIME-Version: 1.0\r\n";
@@ -155,7 +171,7 @@ public function recover(){
155171
$response['danger'] = 'Could not send email with reset instructions.';
156172
}
157173
else {
158-
$response['success'] = 'Email Sent! Please check your inbox and follow instructions.';
174+
$response['success'] = 'Email Sent! Please check your inbox and follow instructions. <strong>Please allow up to 10 minutes for your email to arrive, and please check your spam folder.</strong>';
159175
}
160176

161177
} else {
@@ -174,7 +190,6 @@ public function reset(){
174190
$valid_code = false;
175191
} else {
176192
$recovery = filter_var($_GET['recovery'], FILTER_SANITIZE_STRING);
177-
echo $recovery;
178193
$user = $this->User->find(array('recovery' => $recovery));
179194

180195
if( strtotime($user[0]->recovery_expires) > time() ) {

app/view/search/index.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@
303303
<section class="row" id="impact-header">
304304
<div class="col-sm-12 text-center">
305305

306-
<h2>The Restart Project</h2>
307-
308306
<p class="big">
309307
<span class="big blue"><?php echo $pax; ?> participants</span> aided by <span class="big blue"><?php echo $hours; ?> hours of volunteered time</span> worked on <span class="big blue"><?php echo ($device_count_status[0]->counter + $device_count_status[1]->counter + $device_count_status[2]->counter) ?> devices.</span>
310308
</p>

app/view/user/login.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<div class="form-group">
1515
<label for="password" class="text-center">password</label>
1616
<input type="password" class="form-control" name="password" id="password" placeholder="Your password...">
17-
<a class="btn btn-link btn-sm" href="/user/recover">password forgot?</a>
17+
<div class="forgot-password-container">
18+
<a href="/user/recover">forgotten your password?</a>
19+
</div>
1820
</div>
1921
<div class="form-group text-center">
2022

app/view/user/recover.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
<div class="text-center">
33
<img src="/assets/images/logo_mini.png" alt="The Restart Project">
44
</div>
5-
<p class="login-text">Please input the email address you used to register with the Fixometer. The system will send you an email with instructions on how to recover access to your account. </p>
5+
<p class="login-text"><span class="patua-blue">Welcome to our community space,</span> where you can share upcoming Restart Parties and track their social and environmental impact. By doing so, we can empower and motivate at a local level, but also build global momentum for a change.</p>
66
<?php if(isset($response)) { printResponse($response); } ?>
77
<div class="shader"></div>
88
<h2><span class="title-text">recover your password</span></h2>
99

10+
<p class="explainer-text">Please input the email address that was used when you first registered with the Fixometer. The system will send you an email with instructions on how to recover the access to your account. </p>
11+
1012
<form class="" method="post" action="/user/recover">
1113

1214
<div class="form-group">

app/view/user/reset.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
<div class="text-center">
33
<img src="/assets/images/logo_mini.png" alt="The Restart Project">
44
</div>
5+
<p class="login-text"><span class="patua-blue">Welcome to our community space,</span> where you can share upcoming Restart Parties and track their social and environmental impact. By doing so, we can empower and motivate at a local level, but also build global momentum for a change.</p>
56
<?php if($valid_code == false) { ?>
67
<p class="login-text text-center">The recovery code you're using is invalid. Please proceed to request a new recovery link <a href="/user/recover">here</a>.</p>
78
<?php } else { ?>
8-
<p class="login-text text-center">Please input your new password here.</p>
99
<?php if(isset($response)) { printResponse($response); } ?>
1010
<div class="shader"></div>
1111
<h2><span class="title-text">Reset your password</span></h2>
1212

13+
<p class="explainer-text">Please input your new password here, and then click the button below to reset your password.</p>
14+
1315
<form class="" method="post" action="/user/reset?recovery=<?php echo $recovery; ?>">
1416
<input type="hidden" name="recovery" value="<?php echo $recovery; ?>">
1517
<div class="form-group">

config/config.example.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/** Application Name **/
33
define( 'APPNAME', 'Fixometer');
44
define( 'APPKEY', 'l[56pOkjg_I8874.'); // should be a random string
5-
define( 'APPEMAIL', 'your@email.org');
5+
define( 'APPEMAIL', 'your@email.org'); // auto generated emails are sent from this address
6+
define( 'SUPPORT_CONTACT_EMAIL', "fry@planetexpress.com"); // address users can contact for help
67

78
/** Secret! **/
89
define( 'SECRET', strrev(md5(APPKEY)));

public/dist/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/src/less/main.less

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ h3 {
299299
*vertical-align: auto;
300300
position: relative;
301301
padding: 0 20px;
302-
line-height: 90%;
303302
&:before, &:after {
304303
content: '';
305304
display: block;
@@ -332,13 +331,23 @@ h3 {
332331
button.btn.btn-primary.login-button {
333332
width: 100px;
334333
height: 100px;
335-
margin-top: 35px;
334+
margin-top: 15px;
336335
.border-radius(50px);
337336
i.fa { font-size: 50px; }
338337

339338

340339
}
340+
341+
.forgot-password-container {
342+
text-align:right;
343+
margin-top:10px;
344+
}
345+
346+
.explainer-text {
347+
font-size: 16px;
348+
}
341349
}
350+
342351
.login-deets {
343352
width: 50%;
344353
float: left;

0 commit comments

Comments
 (0)