Commit 780786ba4df5ba9132a8354602f54d051be25669

Authored by Melody

Merge branch 'master' of git.ucsd.edu:110swag/flashy-frontend

Showing 5 changed files Side-by-side Diff

scripts/LoginController.js View file @ 780786b
... ... @@ -3,7 +3,6 @@
3 3 controller('LoginController', ['$scope', '$state', '$http', 'UserService',
4 4 function($scope, $state, $http, UserService) {
5 5 'use strict';
6   -
7 6 $scope.uniqueError = false;
8 7 $scope.loginError = false;
9 8 $scope.login = function(email, password) {
scripts/RequestResetController.js View file @ 780786b
... ... @@ -11,13 +11,15 @@
11 11 }))
12 12 .success(function(data) {
13 13 $scope.success = true;
14   - $state.go('passwordreset');
  14 + //$state.go('requestresetsuccess');
  15 + console.log("SUCCESS");
15 16 console.log(data);
16 17 })
17 18 .error(function(data, status, header, config) {
18 19 if (data.email) {
19 20 $scope.error = true;
20 21 }
  22 + console.log("ERROR");
21 23 console.log(data);
22 24 });
23 25 };
scripts/ResetPasswordController.js View file @ 780786b
1 1 angular.module('flashy.ResetPasswordController', ['ui.router']).
2 2  
3   - controller('ResetPasswordController', ['$scope', '$state', '$http',
4   - function($scope, $state, $http) {
  3 + controller('ResetPasswordController', ['$scope', '$state', '$http', '$timeout',
  4 + function($scope, $state, $http, $timeout) {
5 5 'use strict';
6 6 var url = document.location.href.split('/');
7 7 var token = url[url.length-1];
8 8 var uid = url[url.length-2];
9 9 $scope.error = false;
  10 + $scope.success = false;
10 11 $scope.mismatch = false;
11 12 $scope.unacceptable = false;
12 13 /*if(token == 'resetpassword') {
13 14 $state.go('login');
14 15 }*/
  16 + console.log("RESETTING");
15 17 $scope.confirmResetPass = function() {
16 18 if($scope.newPassword.length < 8) {
17 19 $scope.unacceptable = true;
18 20  
... ... @@ -30,11 +32,16 @@
30 32 }))
31 33 .success(function(data) {
32 34 $scope.error = false;
33   - $state.go('resetpasssuccess');
  35 + $scope.success = true;
  36 + //$state.go('resetpasssuccess');
  37 + $timeout(function($state) {
  38 + $state.go('login');
  39 + }, 1000);
34 40 console.log(data);
35 41 })
36 42 .error(function(data, status, header, config) {
37 43 $scope.error = true;
  44 + $scope.success = false;
38 45 $scope.mismatch = false;
39 46 $scope.unacceptable = false;
40 47 console.log(data);
templates/requestpasswordreset.html View file @ 780786b
1   -<div class="row">
  1 +<div class="row" ng-show="success">
  2 + <h1>Request Sent!</h1>
  3 +</div>
  4 +
  5 +<div class="row" ng-hide="success">
2 6 <div class="offset-s2 col s8">
3 7 <div class="card">
4 8 <form class="col s12" name="passreset_form">
templates/resetpassword.html View file @ 780786b
1   -<div class="container">
  1 +<div class="row" ng-hide="success">
  2 + <h1>Reset Password Success!</h1>
  3 +</div>
  4 +
  5 +<div class="container" ng-show="success">
2 6 <div class="row">
3 7 <div class="offset-s2 col s8">
4 8 <div class="card">
... ... @@ -6,7 +10,6 @@
6 10 <div class="card-content">
7 11 <h2 class="">Reset Password</h2>
8 12 </div>
9   -
10 13 <div class="divider"></div>
11 14 <div class="card-content">
12 15 <!--ERRORS-->