From a97841dff44e8cfe8b77a8789f9157003efbd15d Mon Sep 17 00:00:00 2001
From: Andrew Buss <abuss@ucsd.edu>
Date: Tue, 26 May 2015 16:09:51 -0700
Subject: [PATCH] Make submit the default action for the reset password page

---
 home.html                           |  4 +--
 scripts/RequestResetController.js   | 50 +++++++++++++++++--------------------
 templates/requestpasswordreset.html |  5 ++--
 3 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/home.html b/home.html
index 9f63cd8..2b6b2cc 100644
--- a/home.html
+++ b/home.html
@@ -39,12 +39,12 @@
         <!-- User's classes dropdown -->
         <ul id="dropdown1" class="dropdown-content">
           <li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections">
-            <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}<span class="badge">hi</span></a>
+            <a ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
           </li>
           <li class="divider"></li>
           <li><a ui-sref="addclass">Add Class</a></li>
         </ul>
-        <li><a style="width:150px;" class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
+        <li><a style="width:175px;" class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
                 class="mdi-navigation-arrow-drop-down right"></i></a></li>
         <li><a ui-sref="study">Study</a></li>
         <li><a ui-sref="logout">Logout</a></li>
diff --git a/scripts/RequestResetController.js b/scripts/RequestResetController.js
index 3cc79ab..892cefc 100644
--- a/scripts/RequestResetController.js
+++ b/scripts/RequestResetController.js
@@ -1,30 +1,26 @@
 angular.module('flashy.RequestResetController', ['ui.router']).
 
-controller('RequestResetController', ['$scope', '$state', '$http',
-      function($scope, $state, $http) {
-    'use strict';
-    $scope.success = false;
-    $scope.error = false;
-    $scope.resetPass = function(email) {
-        $http.post('/api/request_password_reset/', JSON.stringify({
-            'email': email
-        })).
-        success(function(data) {
-            $scope.success = true;
-            //$state.go('requestresetsuccess');
-            console.log('SUCCESS');
-                console.log(data);
-        }).
-        error(function(data, status, header, config) {
-            if (data.email) {
-                $scope.error = true;
-            }
-        console.log('ERROR');
-            console.log(data);
-        });
-    };
+    controller('RequestResetController', function($scope, $state, $http) {
+        $scope.success = false;
+        $scope.error = false;
+        $scope.resetPass = function(email) {
+            $http.post('/api/request_password_reset/', {email: email}).
+                success(function(data) {
+                    $scope.success = true;
+                    //$state.go('requestresetsuccess');
+                    console.log('SUCCESS');
+                    console.log(data);
+                }).
+                error(function(data, status, header, config) {
+                    if (data.email) {
+                        $scope.error = true;
+                    }
+                    console.log('ERROR');
+                    console.log(data);
+                });
+        };
 
-    $scope.cancelReset = function() {
-        $state.go('login');
-    };
-}]);
+        $scope.cancelReset = function() {
+            $state.go('login');
+        };
+    });
diff --git a/templates/requestpasswordreset.html b/templates/requestpasswordreset.html
index b1238c7..ba15111 100644
--- a/templates/requestpasswordreset.html
+++ b/templates/requestpasswordreset.html
@@ -27,10 +27,11 @@
     </div>
 
     <div class="card-action">
+      <button class="btn waves-effect waves-light green right" type="submit" name="action"
+              ng-click="resetPass(user_email)">Reset</button>
       <button class="btn waves-effect waves-light red" type="submit" name="action"
               ng-click="cancelReset()">Cancel</button>
-      <button class="btn waves-effect waves-light green right" type="submit" name="action" 
-              ng-click="resetPass(user_email)">Reset</button>
+
     </div>
   </form>
 </div>
-- 
1.9.1