diff --git a/scripts/FeedController.js b/scripts/FeedController.js index a27c3cb..2c31656 100644 --- a/scripts/FeedController.js +++ b/scripts/FeedController.js @@ -25,6 +25,10 @@ angular.module('flashy.FeedController', ['ui.router']). }; $scope.pullCard = function(card) { + /* + $http.post('/api/flashcards/pk/pull', + {} + */ var index = $scope.cards.indexOf(card); console.log($scope.cards[index]); diff --git a/scripts/RequestResetController.js b/scripts/RequestResetController.js index 78b1cea..3cc79ab 100644 --- a/scripts/RequestResetController.js +++ b/scripts/RequestResetController.js @@ -1,30 +1,30 @@ -angular.module('flashy.RequestResetController', ['ui.router']) +angular.module('flashy.RequestResetController', ['ui.router']). - .controller('RequestResetController', ['$scope', '$state', '$http', - function($scope, $state, $http) { - 'use strict'; - $scope.success = false; - $scope.error = false; - $scope.resetPass = function(email) { - $http.post('/api/request_password_reset/', JSON.stringify({ - 'email': email - })) - .success(function(data) { - $scope.success = true; - //$state.go('requestresetsuccess'); - console.log('SUCCESS'); - console.log(data); - }) - .error(function(data, status, header, config) { - if (data.email) { - $scope.error = true; - } - console.log('ERROR'); - console.log(data); - }); - }; - $scope.cancelReset = function() { - $state.go('login'); - }; - } - ]); +controller('RequestResetController', ['$scope', '$state', '$http', + function($scope, $state, $http) { + 'use strict'; + $scope.success = false; + $scope.error = false; + $scope.resetPass = function(email) { + $http.post('/api/request_password_reset/', JSON.stringify({ + 'email': email + })). + success(function(data) { + $scope.success = true; + //$state.go('requestresetsuccess'); + console.log('SUCCESS'); + console.log(data); + }). + error(function(data, status, header, config) { + if (data.email) { + $scope.error = true; + } + console.log('ERROR'); + console.log(data); + }); + }; + + $scope.cancelReset = function() { + $state.go('login'); + }; +}]); diff --git a/scripts/ResetPasswordController.js b/scripts/ResetPasswordController.js index ab5c4d1..a7a5650 100644 --- a/scripts/ResetPasswordController.js +++ b/scripts/ResetPasswordController.js @@ -1,54 +1,52 @@ angular.module('flashy.ResetPasswordController', ['ui.router']). - controller('ResetPasswordController', ['$scope', '$state', '$http', '$timeout', - function($scope, $state, $http, $timeout) { - 'use strict'; - var url = document.location.href.split('/'); - var token = url[url.length - 1]; - var uid = url[url.length - 2]; - $scope.error = false; - $scope.success = false; - $scope.mismatch = false; - $scope.unacceptable = false; - /*if(token == 'resetpassword') { - $state.go('login'); - }*/ - console.log('RESETTING'); - $scope.confirmResetPass = function() { - if ($scope.newPassword.length < 8) { - $scope.unacceptable = true; - return; - } - if ($scope.newPassword != $scope.confirmPassword) { - $scope.mismatch = true; - $scope.confirmPassword.$setPristine(); - console.log('mismatch'); - return; - } - $http.post('/api/reset_password/', JSON.stringify({ - 'uid': uid, - 'token': token, - 'new_password': $scope.newPassword - })) - .success(function(data) { - $scope.error = false; - $scope.success = true; - //$state.go('resetpasssuccess'); - $timeout(function($state) { - $state.go('login'); - }, 1000); - console.log(data); - }) - .error(function(data, status, header, config) { - $scope.error = true; - $scope.success = false; - $scope.mismatch = false; - $scope.unacceptable = false; - console.log(data); - }); - }; - $scope.cancelReset = function() { - $state.go('login'); - }; - } - ]); +controller('ResetPasswordController', ['$scope', '$state', '$http', '$timeout', + function($scope, $state, $http, $timeout) { + 'use strict'; + var url = document.location.href.split('/'); + var token = url[url.length - 1]; + var uid = url[url.length - 2]; + $scope.error = false; + $scope.success = false; + $scope.mismatch = false; + $scope.unacceptable = false; + /*if(token == 'resetpassword') { + $state.go('login'); + }*/ + console.log('RESETTING'); + $scope.confirmResetPass = function() { + if ($scope.newPassword.length < 8) { + $scope.unacceptable = true; + return; + } + if ($scope.newPassword != $scope.confirmPassword) { + $scope.mismatch = true; + $scope.confirmPassword.$setPristine(); + console.log('mismatch'); + return; + } + $http.post('/api/reset_password/', JSON.stringify({ + 'uid': uid, + 'token': token, + 'new_password': $scope.newPassword + })).success(function(data) { + $scope.error = false; + $scope.success = true; + //$state.go('resetpasssuccess'); + $timeout(function($state) { + $state.go('login'); + }, 1000); + console.log(data); + + }).error(function(data, status, header, config) { + $scope.error = true; + $scope.success = false; + $scope.mismatch = false; + $scope.unacceptable = false; + console.log(data); + }); + }; + $scope.cancelReset = function() { + $state.go('login'); + }; +}]);