Commit a97841dff44e8cfe8b77a8789f9157003efbd15d

Authored by Andrew Buss
1 parent f555fa186d

Make submit the default action for the reset password page

Showing 3 changed files with 28 additions and 31 deletions Side-by-side Diff

... ... @@ -39,12 +39,12 @@
39 39 <!-- User's classes dropdown -->
40 40 <ul id="dropdown1" class="dropdown-content">
41 41 <li ui-sref-active="active" ng-repeat="section in UserService.getUserData().sections">
42   - <a class="class bold" ui-sref="feed({sectionId:section.id})">{{section.short_name}}<span class="badge">hi</span></a>
  42 + <a ui-sref="feed({sectionId:section.id})">{{section.short_name}}</a>
43 43 </li>
44 44 <li class="divider"></li>
45 45 <li><a ui-sref="addclass">Add Class</a></li>
46 46 </ul>
47   - <li><a style="width:150px;" class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
  47 + <li><a style="width:175px;" class="dropdown-button ng-cloak" href="#!" data-activates="dropdown1">{{currentSection.id?currentSection.short_name:"Classes"}}<i
48 48 class="mdi-navigation-arrow-drop-down right"></i></a></li>
49 49 <li><a ui-sref="study">Study</a></li>
50 50 <li><a ui-sref="logout">Logout</a></li>
scripts/RequestResetController.js View file @ a97841d
1 1 angular.module('flashy.RequestResetController', ['ui.router']).
2 2  
3   -controller('RequestResetController', ['$scope', '$state', '$http',
4   - function($scope, $state, $http) {
5   - 'use strict';
6   - $scope.success = false;
7   - $scope.error = 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   - //$state.go('requestresetsuccess');
15   - console.log('SUCCESS');
16   - console.log(data);
17   - }).
18   - error(function(data, status, header, config) {
19   - if (data.email) {
20   - $scope.error = true;
21   - }
22   - console.log('ERROR');
23   - console.log(data);
24   - });
25   - };
  3 + controller('RequestResetController', function($scope, $state, $http) {
  4 + $scope.success = false;
  5 + $scope.error = false;
  6 + $scope.resetPass = function(email) {
  7 + $http.post('/api/request_password_reset/', {email: email}).
  8 + success(function(data) {
  9 + $scope.success = true;
  10 + //$state.go('requestresetsuccess');
  11 + console.log('SUCCESS');
  12 + console.log(data);
  13 + }).
  14 + error(function(data, status, header, config) {
  15 + if (data.email) {
  16 + $scope.error = true;
  17 + }
  18 + console.log('ERROR');
  19 + console.log(data);
  20 + });
  21 + };
26 22  
27   - $scope.cancelReset = function() {
28   - $state.go('login');
29   - };
30   -}]);
  23 + $scope.cancelReset = function() {
  24 + $state.go('login');
  25 + };
  26 + });
templates/requestpasswordreset.html View file @ a97841d
... ... @@ -27,10 +27,11 @@
27 27 </div>
28 28  
29 29 <div class="card-action">
  30 + <button class="btn waves-effect waves-light green right" type="submit" name="action"
  31 + ng-click="resetPass(user_email)">Reset</button>
30 32 <button class="btn waves-effect waves-light red" type="submit" name="action"
31 33 ng-click="cancelReset()">Cancel</button>
32   - <button class="btn waves-effect waves-light green right" type="submit" name="action"
33   - ng-click="resetPass(user_email)">Reset</button>
  34 +
34 35 </div>
35 36 </form>
36 37 </div>