Commit 4bbb4161c10e6cae6021b6689e851915a7c63f03
1 parent
e303b86ecf
Exists in
master
and in
1 other branch
Fixing js styling for password reset, starting on feed pull
Showing 3 changed files with 83 additions and 81 deletions Side-by-side Diff
scripts/FeedController.js
View file @
4bbb416
scripts/RequestResetController.js
View file @
4bbb416
1 | -angular.module('flashy.RequestResetController', ['ui.router']) | |
1 | +angular.module('flashy.RequestResetController', ['ui.router']). | |
2 | 2 | |
3 | - .controller('RequestResetController', ['$scope', '$state', '$http', | |
4 | - function($scope, $state, $http) { | |
5 | - 'use strict'; | |
6 | - $scope.success = false; | |
7 | - $scope.error = false; | |
8 | - $scope.resetPass = function(email) { | |
9 | - $http.post('/api/request_password_reset/', JSON.stringify({ | |
10 | - 'email': email | |
11 | - })) | |
12 | - .success(function(data) { | |
13 | - $scope.success = true; | |
14 | - //$state.go('requestresetsuccess'); | |
15 | - console.log('SUCCESS'); | |
16 | - console.log(data); | |
17 | - }) | |
18 | - .error(function(data, status, header, config) { | |
19 | - if (data.email) { | |
20 | - $scope.error = true; | |
21 | - } | |
22 | - console.log('ERROR'); | |
23 | - console.log(data); | |
24 | - }); | |
25 | - }; | |
26 | - $scope.cancelReset = function() { | |
27 | - $state.go('login'); | |
28 | - }; | |
29 | - } | |
30 | - ]); | |
3 | +controller('RequestResetController', ['$scope', '$state', '$http', | |
4 | + function($scope, $state, $http) { | |
5 | + 'use strict'; | |
6 | + $scope.success = false; | |
7 | + $scope.error = false; | |
8 | + $scope.resetPass = function(email) { | |
9 | + $http.post('/api/request_password_reset/', JSON.stringify({ | |
10 | + 'email': email | |
11 | + })). | |
12 | + success(function(data) { | |
13 | + $scope.success = true; | |
14 | + //$state.go('requestresetsuccess'); | |
15 | + console.log('SUCCESS'); | |
16 | + console.log(data); | |
17 | + }). | |
18 | + error(function(data, status, header, config) { | |
19 | + if (data.email) { | |
20 | + $scope.error = true; | |
21 | + } | |
22 | + console.log('ERROR'); | |
23 | + console.log(data); | |
24 | + }); | |
25 | + }; | |
26 | + | |
27 | + $scope.cancelReset = function() { | |
28 | + $state.go('login'); | |
29 | + }; | |
30 | +}]); |
scripts/ResetPasswordController.js
View file @
4bbb416
1 | 1 | angular.module('flashy.ResetPasswordController', ['ui.router']). |
2 | 2 | |
3 | - controller('ResetPasswordController', ['$scope', '$state', '$http', '$timeout', | |
4 | - function($scope, $state, $http, $timeout) { | |
5 | - 'use strict'; | |
6 | - var url = document.location.href.split('/'); | |
7 | - var token = url[url.length - 1]; | |
8 | - var uid = url[url.length - 2]; | |
9 | - $scope.error = false; | |
10 | - $scope.success = false; | |
11 | - $scope.mismatch = false; | |
12 | - $scope.unacceptable = false; | |
13 | - /*if(token == 'resetpassword') { | |
14 | - $state.go('login'); | |
15 | - }*/ | |
16 | - console.log('RESETTING'); | |
17 | - $scope.confirmResetPass = function() { | |
18 | - if ($scope.newPassword.length < 8) { | |
19 | - $scope.unacceptable = true; | |
20 | - return; | |
21 | - } | |
22 | - if ($scope.newPassword != $scope.confirmPassword) { | |
23 | - $scope.mismatch = true; | |
24 | - $scope.confirmPassword.$setPristine(); | |
25 | - console.log('mismatch'); | |
26 | - return; | |
27 | - } | |
28 | - $http.post('/api/reset_password/', JSON.stringify({ | |
29 | - 'uid': uid, | |
30 | - 'token': token, | |
31 | - 'new_password': $scope.newPassword | |
32 | - })) | |
33 | - .success(function(data) { | |
34 | - $scope.error = false; | |
35 | - $scope.success = true; | |
36 | - //$state.go('resetpasssuccess'); | |
37 | - $timeout(function($state) { | |
38 | - $state.go('login'); | |
39 | - }, 1000); | |
40 | - console.log(data); | |
41 | - }) | |
42 | - .error(function(data, status, header, config) { | |
43 | - $scope.error = true; | |
44 | - $scope.success = false; | |
45 | - $scope.mismatch = false; | |
46 | - $scope.unacceptable = false; | |
47 | - console.log(data); | |
48 | - }); | |
49 | - }; | |
50 | - $scope.cancelReset = function() { | |
51 | - $state.go('login'); | |
52 | - }; | |
53 | - } | |
54 | - ]); | |
3 | +controller('ResetPasswordController', ['$scope', '$state', '$http', '$timeout', | |
4 | + function($scope, $state, $http, $timeout) { | |
5 | + 'use strict'; | |
6 | + var url = document.location.href.split('/'); | |
7 | + var token = url[url.length - 1]; | |
8 | + var uid = url[url.length - 2]; | |
9 | + $scope.error = false; | |
10 | + $scope.success = false; | |
11 | + $scope.mismatch = false; | |
12 | + $scope.unacceptable = false; | |
13 | + /*if(token == 'resetpassword') { | |
14 | + $state.go('login'); | |
15 | + }*/ | |
16 | + console.log('RESETTING'); | |
17 | + $scope.confirmResetPass = function() { | |
18 | + if ($scope.newPassword.length < 8) { | |
19 | + $scope.unacceptable = true; | |
20 | + return; | |
21 | + } | |
22 | + if ($scope.newPassword != $scope.confirmPassword) { | |
23 | + $scope.mismatch = true; | |
24 | + $scope.confirmPassword.$setPristine(); | |
25 | + console.log('mismatch'); | |
26 | + return; | |
27 | + } | |
28 | + $http.post('/api/reset_password/', JSON.stringify({ | |
29 | + 'uid': uid, | |
30 | + 'token': token, | |
31 | + 'new_password': $scope.newPassword | |
32 | + })).success(function(data) { | |
33 | + $scope.error = false; | |
34 | + $scope.success = true; | |
35 | + //$state.go('resetpasssuccess'); | |
36 | + $timeout(function($state) { | |
37 | + $state.go('login'); | |
38 | + }, 1000); | |
39 | + console.log(data); | |
40 | + | |
41 | + }).error(function(data, status, header, config) { | |
42 | + $scope.error = true; | |
43 | + $scope.success = false; | |
44 | + $scope.mismatch = false; | |
45 | + $scope.unacceptable = false; | |
46 | + console.log(data); | |
47 | + }); | |
48 | + }; | |
49 | + $scope.cancelReset = function() { | |
50 | + $state.go('login'); | |
51 | + }; | |
52 | +}]); |