From 148735bcc77063b3daef55beb3ec787f8d9413e9 Mon Sep 17 00:00:00 2001 From: Tetranoir Date: Sat, 16 May 2015 04:45:17 -0700 Subject: [PATCH] added resetpassword --- config.js | 8 +++++++- home.html | 1 + scripts/ResetPasswordController.js | 29 +++++++++++++++++++++++++++++ templates/login.html | 4 ++-- templates/resetpassword.html | 30 ++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index 5b0c188..0f1994c 100644 --- a/config.js +++ b/config.js @@ -7,6 +7,7 @@ angular.module('flashy', [ 'flashy.ClassAddController', 'flashy.RequestResetController', 'flashy.UserService', + 'flashy.ResetPasswordController', 'ngCookies']). config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', @@ -52,6 +53,11 @@ angular.module('flashy', [ url: '/requestpasswordreset', templateUrl: 'templates/requestpasswordreset.html', controller: 'RequestResetController' - }); + }). + state('resetpassword', { + url: '/resetpassword', + templateUrl: 'templates/resetpassword.html', + controller: 'ResetPasswordController' + }); }]); diff --git a/home.html b/home.html index ce211b6..f7c98ef 100644 --- a/home.html +++ b/home.html @@ -30,6 +30,7 @@ + diff --git a/scripts/ResetPasswordController.js b/scripts/ResetPasswordController.js index e69de29..1a590fe 100644 --- a/scripts/ResetPasswordController.js +++ b/scripts/ResetPasswordController.js @@ -0,0 +1,29 @@ +angular.module('flashy.ResetPasswordController', ['ui.router']). + + controller('ResetPasswordController', ['$scope', '$state', '$http', + function($scope, $state, $http) { + 'use strict'; + var url = document.location.href.split("/"); + var token = url[url.length-1]; + var uid = url[url.length-2]; + $scope.error = false; + $scope.confirmResetPass = function(newPassword) { + $http.post('/api/reset_password', JSON.stringify({ + 'uid': uid, + 'token': token + })) + .success(function(data) { + $scope.error = false; + $state.go('resetpasssuccess'); + console.log(data); + }) + .error(function(data, status, header, config) { + $scope.error = true; + console.log(data); + }); + }; + $scope.cancelReset = function() { + $state.go('login'); + }; + } + ]); \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 2caf7c4..0ec3b08 100644 --- a/templates/login.html +++ b/templates/login.html @@ -13,13 +13,13 @@
- +
- +
diff --git a/templates/resetpassword.html b/templates/resetpassword.html index e69de29..bc7ea71 100644 --- a/templates/resetpassword.html +++ b/templates/resetpassword.html @@ -0,0 +1,30 @@ +
+
+

Reset Password

+
+ +
+
+ +
+ + +
+
+ + +
+
+
+ + +
+
+
\ No newline at end of file -- 1.9.1