From 813cab6f9466430969d8c7be1052bdc03d06feda Mon Sep 17 00:00:00 2001 From: Tetranoir Date: Mon, 11 May 2015 02:11:03 -0700 Subject: [PATCH] Added reset request controller, but no html for it yet. Logout page delay not working --- config.js | 7 ++++++- flashy.css | 18 +++++++++++++----- scripts/LoginController.js | 7 +++++-- scripts/LogoutController.js | 12 +++++++----- scripts/RequestResetController.js | 25 +++++++++++++++++++++++++ templates/login_form.html | 16 +++++++++++----- templates/logout.html | 3 +++ 7 files changed, 70 insertions(+), 18 deletions(-) create mode 100644 scripts/RequestResetController.js create mode 100644 templates/logout.html diff --git a/config.js b/config.js index c4189a6..33ba37f 100644 --- a/config.js +++ b/config.js @@ -44,6 +44,11 @@ angular.module('flashy', [ url: '/deck', templateUrl: 'templates/deck.html', controller: 'DeckController' - }); + }). + state('requestpasswordreset', { + url: '/requestpasswordreset', + templateUrl: 'templates/requestpasswordreset.html', + controller: 'RequestResetController' + }); }]); diff --git a/flashy.css b/flashy.css index 2253a81..50e7ddf 100644 --- a/flashy.css +++ b/flashy.css @@ -1,19 +1,27 @@ #loginform input { - margin: 10px; + margin-top: 5px; + border: 0px none; + font: 16px/1.4 "Helvetica Neue","HelveticaNeue",Helvetica,Arial; + padding: 11px 10px 11px 13px; + width: 100%; + box-sizing: border-box; } #loginform { - max-width: 400px; + width: 100%; max-height: 300px; } - -#sidebar{ +#sidebar { position:absolute; top:100px; left:0px; } -.container{ +.diclaimer { + color:#00AFD8; +} + +.container { width: 500px; } diff --git a/scripts/LoginController.js b/scripts/LoginController.js index 7252489..346b0e2 100644 --- a/scripts/LoginController.js +++ b/scripts/LoginController.js @@ -3,8 +3,8 @@ angular.module('flashy.LoginController', ['ui.router']). controller('LoginController', ['$scope', '$state', '$http', function($scope, $state, $http) { 'use strict'; - $scope.emailError = false - $scope.loginError = false + $scope.emailError = false; + $scope.loginError = false; $scope.login = function(email, password) { $http.post('/api/login', JSON.stringify({ 'email': email, @@ -38,5 +38,8 @@ controller('LoginController', ['$scope', '$state', '$http', console.log(data); }); }; + $scope.triggerPasswordReset = function() { + $state.go('requestpasswordreset'); + }; } ]); diff --git a/scripts/LogoutController.js b/scripts/LogoutController.js index 286da94..6a5d4b6 100644 --- a/scripts/LogoutController.js +++ b/scripts/LogoutController.js @@ -1,7 +1,9 @@ angular.module('flashy.LogoutController', ['ui.router']). - controller('LogoutController', ['$scope', '$state', '$http', function($scope, $state, $http) { - $http.post('/api/logout').success(function() { - $state.go('home'); - }); - }]); +controller('LogoutController', ['$scope', '$state', '$timeout', + function($scope, $state, $timeout) { + $timeout(function($state) { + $state.go('home'); + }, 1000); + } +]); diff --git a/scripts/RequestResetController.js b/scripts/RequestResetController.js new file mode 100644 index 0000000..bd68b1f --- /dev/null +++ b/scripts/RequestResetController.js @@ -0,0 +1,25 @@ +angular.module('flashy.RequestResetController', ['ui.router']). + +controller('RequestResetController', ['$scope', '$state', 'http', + function($scope, $state, $http) { + 'use strict'; + $scope.success = false; + $scope.alert = false; + $scope.resetPass = function(email) { + $http.post('/api/request_password_reset', JSON.stringify({ + 'email': email + })) + .success(function(data) { + $scope.success = true; + console.log(data); + }) + .error(function(data, status, header, config) { + if(data.email) { + $scope.success = false; + $scope.alert = true; + } + console.log(data) + }); + } + } +]); \ No newline at end of file diff --git a/templates/login_form.html b/templates/login_form.html index 9309425..fc37d40 100644 --- a/templates/login_form.html +++ b/templates/login_form.html @@ -21,7 +21,7 @@
-
+
@@ -38,13 +38,13 @@
- - + + +
@@ -66,5 +71,6 @@
- --> + --> +
diff --git a/templates/logout.html b/templates/logout.html new file mode 100644 index 0000000..ecb6a2b --- /dev/null +++ b/templates/logout.html @@ -0,0 +1,3 @@ +
+

You have successfully logged out.

+
\ No newline at end of file -- 1.9.1