Commit f29eea44a18ac77233e98a8ccc76319835912a60
1 parent
c9444dfd42
Exists in
master
and in
1 other branch
materialized resetpass and requestpasswordreset
Showing 4 changed files with 66 additions and 52 deletions Side-by-side Diff
scripts/RequestResetController.js
View file @
f29eea4
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | function($scope, $state, $http) { |
5 | 5 | 'use strict'; |
6 | 6 | $scope.success = false; |
7 | - $scope.invalid = false; | |
7 | + $scope.error = false; | |
8 | 8 | $scope.resetPass = function(email) { |
9 | 9 | $http.post('/api/request_password_reset', JSON.stringify({ |
10 | 10 | 'email': email |
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | }) |
17 | 17 | .error(function(data, status, header, config) { |
18 | 18 | if (data.email) { |
19 | - $scope.invalid = true; | |
19 | + $scope.error = true; | |
20 | 20 | } |
21 | 21 | console.log(data); |
22 | 22 | }); |
scripts/ResetPasswordController.js
View file @
f29eea4
... | ... | @@ -3,10 +3,13 @@ |
3 | 3 | controller('ResetPasswordController', ['$scope', '$state', '$http', |
4 | 4 | function($scope, $state, $http) { |
5 | 5 | 'use strict'; |
6 | - var url = document.location.href.split("/"); | |
6 | + var url = document.location.href.split('/'); | |
7 | 7 | var token = url[url.length-1]; |
8 | 8 | var uid = url[url.length-2]; |
9 | 9 | $scope.error = false; |
10 | + /*if(token == 'resetpassword') { | |
11 | + $state.go('login'); | |
12 | + }*/ | |
10 | 13 | $scope.confirmResetPass = function(newPassword) { |
11 | 14 | $http.post('/api/reset_password', JSON.stringify({ |
12 | 15 | 'uid': uid, |
templates/requestpasswordreset.html
View file @
f29eea4
1 | -<div class="content"> | |
2 | - <div class="container"> | |
3 | - <h1 class="text-muted">Reset Password</h1> | |
1 | +<div class="container"> | |
2 | +<div class="row"> | |
3 | +<div class="offset-s2 col s8"> | |
4 | +<div class="card"> | |
5 | + <form class="col s12" name="passreset_form"> | |
6 | + <div class="card-content"> | |
7 | + <h2>Reset Password</h2> | |
4 | 8 | </div> |
5 | - <div name="passreset" class="form-section"> | |
6 | - <form class="form-inputs" name="passreset_form"> | |
7 | - <div class="check-element animate-show" role="alert" ng-show="invalid"> | |
8 | - <span style="color:#8E2323">Enter a valid email!</span> | |
9 | - </div> | |
10 | - <!--FORM INPUTS--> | |
11 | - <div class="form-group"> | |
12 | - <input type="email" class="form-control" ng-model="user_email" placeholder="Email" required /> | |
13 | - </div> | |
14 | - <div class="row"> | |
15 | - <div class="btn-group"> | |
16 | - <button type="button" class="btn btn-default" ng-click="cancelReset()"><strong>Cancel</strong></button> | |
17 | - </div> | |
18 | - <div class="last-button"> | |
19 | - <div class="btn-group"> | |
20 | - <button type="button" class="btn btn-danger" ng-click="resetPass(user_email)"><strong>Reset Password</strong></button> | |
21 | - </div> | |
22 | - </div> | |
23 | - </div> | |
24 | - </form> | |
25 | - </div> | |
9 | + | |
10 | + <div class="divider"></div> | |
11 | + <div name="passreset" class="card-content"> | |
12 | + <div class="section"> | |
13 | + <div ng-show="error" role="error"> | |
14 | + <i style="color:#8E2323" class="mdi-alert-error"></i> | |
15 | + <span style="color:#8E2323">Enter a valid email!</span> | |
16 | + </div> | |
17 | + </div> | |
18 | + <!--FORM INPUT--> | |
19 | + <input id="email" type="email" class="form-control" ng-model="user_email" placeholder="Email" required /> | |
20 | + <label for="email">Enter Your Email</label> | |
21 | + </div> | |
22 | + | |
23 | + <div class="card-action"> | |
24 | + <button class="btn waves-effect waves-light red" type="submit" name="action" | |
25 | + ng-click="cancelReset()">Cancel</button> | |
26 | + <button class="btn waves-effect waves-light green right" type="submit" name="action" | |
27 | + ng-click="resetPass(user_email)">Reset</button> | |
28 | + </div> | |
29 | + </form> | |
30 | +</div> | |
31 | +</div> | |
32 | +</div> | |
26 | 33 | </div> |
templates/resetpassword.html
View file @
f29eea4
1 | 1 | <div class="container"> |
2 | - <div class="row"> | |
3 | - <h1>Reset Password</h1> | |
4 | - </div> | |
5 | - | |
6 | - <div class="row"> | |
7 | - <form class="col s12"> | |
8 | - <div class="row" ng-show="error" role="alert"> | |
9 | - <i style="color:#8E2323" class="mdi-alert-error"></i> | |
10 | - <span style="color:#8E2323">Please use link from email!</span> | |
2 | +<div class="row"> | |
3 | +<div class="offset-s2 col s8"> | |
4 | +<div class="card"> | |
5 | + <form class="col s12" name="resetpass_form"> | |
6 | + <div class="card-content"> | |
7 | + <h2>Reset Password</h2> | |
8 | + </div> | |
9 | + | |
10 | + <div class="divider"></div> | |
11 | + <div class="card-content"> | |
12 | + <div class="section"> | |
13 | + <div ng-show="error" role="alert"> | |
14 | + <i style="color:#8E2323" class="mdi-alert-error"></i> | |
15 | + <span style="color:#8E2323">Please check your reset password link!</span> | |
16 | + </div> | |
11 | 17 | </div> |
12 | - <div class="row"> | |
13 | - <input id="newpassword" type="password" class="validate" ng-model="newPassword" placeholder="New password" required/> | |
14 | - <label for="newpassword">New password</label> | |
15 | - </div> | |
16 | - <div class="row"> | |
17 | - <input id="confirmpassword" type="password" class="validate" ng-model="confirmPassword" placeholder="Confirm password" required/> | |
18 | - <label for="confirmpassword">Confirm password</label> | |
19 | - </div> | |
20 | - </form> | |
21 | - <div class="row"> | |
18 | + <input id="newpassword" type="password" class="validate" ng-model="newPassword" placeholder="New password" required/> | |
19 | + <label for="newpassword">Password</label> | |
20 | + <input id="confirmpassword" type="password" class="validate" ng-model="confirmPassword" placeholder="Confirm password" required/> | |
21 | + <label for="confirmpassword">Confirm password</label> | |
22 | + </div> | |
23 | + | |
24 | + <div class="card-action"> | |
22 | 25 | <button class="btn waves-effect waves-light red" type="submit" name="action" |
23 | - ng-click="cancelReset()">Cancel | |
24 | - </button> | |
25 | - <button class="btn waves-effect waves-light green" type="submit" name="action" | |
26 | - ng-click="confirmResetPass(newPassword)">Confirm | |
27 | - </button> | |
26 | + ng-click="cancelReset()">Cancel</button> | |
27 | + <button class="btn waves-effect waves-light green right" type="submit" name="action" | |
28 | + ng-click="confirmResetPass(newPassword)">Confirm</button> | |
28 | 29 | </div> |
29 | - </div> | |
30 | + </form> | |
31 | +</div> | |
32 | +</div> | |
33 | +</div> | |
30 | 34 | </div> |