diff --git a/config.js b/config.js index 33ba37f..555f8f7 100644 --- a/config.js +++ b/config.js @@ -4,6 +4,7 @@ angular.module('flashy', [ 'flashy.HomeController', 'flashy.FeedController', 'flashy.DeckController', + 'flashy.RequestResetController', 'ngCookies']). config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', @@ -22,7 +23,7 @@ angular.module('flashy', [ }). state('login', { url: '/login', - templateUrl: 'templates/login_form.html', + templateUrl: 'templates/login.html', controller: 'LoginController' }). state('logout', { diff --git a/flashy.css b/flashy.css index 50e7ddf..3348554 100644 --- a/flashy.css +++ b/flashy.css @@ -1,16 +1,7 @@ #loginform input { - 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 { - width: 100%; - max-height: 300px; -} #sidebar { position:absolute; @@ -22,6 +13,34 @@ color:#00AFD8; } +.form-section { + width: 330px; + top: 50%; + position: relative; +} + +.form-inputs { + margin-top: 0px; + border: 0px none; + font: 16px/1.4 "Helvetica Neue","HelveticaNeue",Helvetica,Arial; + padding: 5px 10px 11px 13px; + width: 100%; + box-sizing: border-box; +} + +.form-buttons { + margin-top: 10px; + width: 100%; + font-size: 16px; +} + +.form-buttons .last-button { + float: right; +} + .container { - width: 500px; + position: relative; + width: 400px; + height: 80px; } + diff --git a/home.html b/home.html index 7196b72..add4d69 100644 --- a/home.html +++ b/home.html @@ -27,6 +27,7 @@ + diff --git a/scripts/LoginController.js b/scripts/LoginController.js index f5b2dac..2c716b7 100644 --- a/scripts/LoginController.js +++ b/scripts/LoginController.js @@ -3,38 +3,41 @@ angular.module('flashy.LoginController', ['ui.router']). controller('LoginController', ['$scope', '$state', '$http', function($scope, $state, $http) { 'use strict'; - $scope.varvar = false - $scope.emailError = false; + $scope.uniqueError = false; $scope.loginError = false; $scope.login = function(email, password) { $http.post('/api/login', JSON.stringify({ 'email': email, 'password': password - })) - .success(function(data) { + })). + success(function(data) { $state.go('feed'); console.log(data); - }) - .error(function(data, status, header, config) { + }). + error(function(data, status, header, config) { if(data.detail) { // assume 'invalid email or pass' - $scope.emailError = true; + $scope.loginError = true; } - console.log(data) + console.log(data); }); }; $scope.signUp = function(email, password) { $http.post('/api/register', JSON.stringify({ 'email': email, 'password': password - })) - .success(function(data) { + })). + success(function(data) { $state.go('feed'); console.log(data); - }) - .error(function(data, status, headers, config) { - if(data.email) { // assume 'email not unique' error - $scope.emailError = true; - email.forcus(); + }). + error(function(data, status, headers, config) { + console.log(data.email); + if(data.email == "This field is required.") { + $scope.invalid = true; + $scope.uniqueError = false; + } else if(data.email) { // assume 'email not unique' error + $scope.uniqueError = true; + $scope.invalid = false; } console.log(data); }); diff --git a/scripts/RequestResetController.js b/scripts/RequestResetController.js index bd68b1f..dc64dc1 100644 --- a/scripts/RequestResetController.js +++ b/scripts/RequestResetController.js @@ -1,25 +1,28 @@ -angular.module('flashy.RequestResetController', ['ui.router']). +angular.module('flashy.RequestResetController', ['ui.router']) -controller('RequestResetController', ['$scope', '$state', 'http', +.controller('RequestResetController', ['$scope', '$state', '$http', function($scope, $state, $http) { 'use strict'; $scope.success = false; - $scope.alert = false; + $scope.invalid = false; $scope.resetPass = function(email) { $http.post('/api/request_password_reset', JSON.stringify({ 'email': email })) .success(function(data) { $scope.success = true; + $state.go('passwordreset'); console.log(data); }) .error(function(data, status, header, config) { if(data.email) { - $scope.success = false; - $scope.alert = true; + $scope.invalid = true; } - console.log(data) + console.log(data); }); - } + }; + $scope.cancel = function() { + $state.go('home'); + }; } ]); \ No newline at end of file diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..7da7812 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,76 @@ +