BrownPaperBag/duffel-auth

View on GitHub
public/javascript/applications/forgot-password/controllers.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

function ForgotPasswordController($scope, $http, $window) {
  $scope.user = {};
  $scope.submitting = false;
  $scope.emailed = false;

  $scope.submit = function() {
    $scope.error = false;
    $scope.submitting = true;
    $http.post('/forgot-password', $scope.user).
      success(function(data, status, headers, config) {
        $scope.emailed = true;
      }).
      error(function(data, status, headers, config) {
        $scope.error = status;
        $scope.submitting = false;
    });
  };
};

angular.module('forgotPassword.controllers', []).
  controller('ForgotPasswordController', ['$scope', '$http', '$window', ForgotPasswordController]);