Commit 813cab6f9466430969d8c7be1052bdc03d06feda

Authored by Tetranoir
1 parent 982b1d0428

Added reset request controller, but no html for it yet. Logout page delay not working

Showing 7 changed files with 70 additions and 18 deletions Side-by-side Diff

... ... @@ -44,7 +44,12 @@
44 44 url: '/deck',
45 45 templateUrl: 'templates/deck.html',
46 46 controller: 'DeckController'
47   - });
  47 + }).
  48 + state('requestpasswordreset', {
  49 + url: '/requestpasswordreset',
  50 + templateUrl: 'templates/requestpasswordreset.html',
  51 + controller: 'RequestResetController'
  52 + });
48 53  
49 54 }]);
1 1 #loginform input {
2   - margin: 10px;
  2 + margin-top: 5px;
  3 + border: 0px none;
  4 + font: 16px/1.4 "Helvetica Neue","HelveticaNeue",Helvetica,Arial;
  5 + padding: 11px 10px 11px 13px;
  6 + width: 100%;
  7 + box-sizing: border-box;
3 8 }
4 9  
5 10 #loginform {
6   - max-width: 400px;
  11 + width: 100%;
7 12 max-height: 300px;
8 13 }
9 14  
10   -
11   -#sidebar{
  15 +#sidebar {
12 16 position:absolute;
13 17 top:100px;
14 18 left:0px;
15 19 }
16 20  
17   -.container{
  21 +.diclaimer {
  22 + color:#00AFD8;
  23 +}
  24 +
  25 +.container {
18 26 width: 500px;
19 27 }
scripts/LoginController.js View file @ 813cab6
... ... @@ -3,8 +3,8 @@
3 3 controller('LoginController', ['$scope', '$state', '$http',
4 4 function($scope, $state, $http) {
5 5 'use strict';
6   - $scope.emailError = false
7   - $scope.loginError = false
  6 + $scope.emailError = false;
  7 + $scope.loginError = false;
8 8 $scope.login = function(email, password) {
9 9 $http.post('/api/login', JSON.stringify({
10 10 'email': email,
... ... @@ -38,6 +38,9 @@
38 38 console.log(data);
39 39 });
40 40 };
  41 + $scope.triggerPasswordReset = function() {
  42 + $state.go('requestpasswordreset');
  43 + };
41 44 }
42 45 ]);
scripts/LogoutController.js View file @ 813cab6
1 1 angular.module('flashy.LogoutController', ['ui.router']).
2 2  
3   - controller('LogoutController', ['$scope', '$state', '$http', function($scope, $state, $http) {
4   - $http.post('/api/logout').success(function() {
5   - $state.go('home');
6   - });
7   - }]);
  3 +controller('LogoutController', ['$scope', '$state', '$timeout',
  4 + function($scope, $state, $timeout) {
  5 + $timeout(function($state) {
  6 + $state.go('home');
  7 + }, 1000);
  8 + }
  9 +]);
scripts/RequestResetController.js View file @ 813cab6
  1 +angular.module('flashy.RequestResetController', ['ui.router']).
  2 +
  3 +controller('RequestResetController', ['$scope', '$state', 'http',
  4 + function($scope, $state, $http) {
  5 + 'use strict';
  6 + $scope.success = false;
  7 + $scope.alert = 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 + console.log(data);
  15 + })
  16 + .error(function(data, status, header, config) {
  17 + if(data.email) {
  18 + $scope.success = false;
  19 + $scope.alert = true;
  20 + }
  21 + console.log(data)
  22 + });
  23 + }
  24 + }
  25 +]);
templates/login_form.html View file @ 813cab6
... ... @@ -21,7 +21,7 @@
21 21 <div class="tab-content" id="registration_forms">
22 22 <!-- SIGN UP FORM -->
23 23 <div class="tab-pane active myform" id="tab1">
24   - <form>
  24 + <form class="login_input_form">
25 25 <div class="form-group">
26 26 <input name="email" type="email" class="form-control" ng-model="signUpEmail" placeholder="Email" required />
27 27 </div>
28 28  
... ... @@ -38,13 +38,13 @@
38 38  
39 39 <!-- LOGIN FORM -->
40 40 <div class="tab-pane myform" id="tab2">
41   - <form>
42   - <div class="check-element animate-show" role="alert" ng-show="loginEmail.$dirty && loginError" />
  41 + <form class="login_input_form">
  42 + <div class="check-element animate-show" role="alert" ng-show="loginEmail.$dirty && loginError">
43 43 <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
44 44 <span style="color:#8E2323">Invalid username or password!</span>
45 45 </div>
46 46 <div class="form-group">
47   - <input type="email" class="form-control" ng-model="loginEmail" placeholder="Email" />
  47 + <input type="email" class="form-control" ng-model="loginEmail" placeholder="Email" value="fe" />
48 48 </div>
49 49 <div class="form-group">
50 50 <input type="password" class="form-control" ng-model="loginPassword" placeholder="Password" />
... ... @@ -53,6 +53,11 @@
53 53 </form>
54 54 </div>
55 55 </div>
  56 +
  57 + <!-- FORGOT PASS -->
  58 + <div class="disclaimer">
  59 + <a class="trigger-password-reset" ng-click="triggerPasswordReset" href="#">I forgot my password</a>
  60 + </div>
56 61 </div>
57 62  
58 63  
... ... @@ -66,6 +71,7 @@
66 71 </div>
67 72 <input type="submit" class="btn btn-primary" ng-click="login(loginEmail, loginPassword)" value="LOGIN"/>
68 73 <input type="submit" class="btn btn-primary" ng-click="register(loginEmail, loginPassword)" value="REGISTER"/>
69   - </form>-->
  74 + -->
  75 + </form>
70 76 </div>
templates/logout.html View file @ 813cab6
  1 +<div class="container">
  2 + <h3 class="text-success heading">You have successfully logged out.</h3>
  3 +</div>