<commit_before>"use strict";

// Serves the forget for the application

module.exports = 'controllers/forget';
var dependencies = [];

angular.module(module.exports, dependencies)
    .config(['$routeProvider',
        function ($routeProvider) {
            $routeProvider
                .when('/forget', {
                    templateUrl: 'views/forget.html',
                    controller: 'ForgetCtrl'
                });
        }
    ])
    .controller('ForgetCtrl', function ($scope) {
        $scope.user = {};
        $scope.$watch('user.email', function () {
            if ($scope.form.email.$error.unknown) {
                $scope.form.email.$setValidity('unknown', true);
                $scope.$broadcast('show-errors-check-validity');
            }
        });
        $scope.submit = function () {
            $scope.$broadcast('show-errors-check-validity');
            if ($scope.form.$valid) {

                // if email is already in use
                $scope.form.email.$setValidity('unknown', false);


                $scope.$broadcast('show-errors-check-validity');
            }
        };
    });<commit_msg>Sending password forget requests<commit_after>"use strict";

// Serves the forget for the application

module.exports = 'controllers/forget';
var dependencies = [];

angular.module(module.exports, dependencies)
    .config(['$routeProvider',
        function ($routeProvider) {
            $routeProvider
                .when('/forget', {
                    templateUrl: 'views/forget.html',
                    controller: 'ForgetCtrl'
                });
        }
    ])
    .controller('ForgetCtrl', function ($scope, $http) {
        $scope.user = {};
        $scope.$watch('user.email', function () {
            if ($scope.form.email.$error.unknown) {
                $scope.form.email.$setValidity('unknown', true);
                $scope.$broadcast('show-errors-check-validity');
            }
        });
        $scope.submit = function () {
            $scope.$broadcast('show-errors-check-validity');
            if ($scope.form.$valid) {
                $http
                    .post(
                        config.server + '/forget',
                        {
                            email: $scope.user.email
                        }
                    )
                    .success(function (data) {
                        if (data == 'unknown email') {
                            $scope.form.email.$setValidity('unknown', false);
                            $scope.$broadcast('show-errors-check-validity');
                        } else {
                            console.log('success', data);
                        }
                    });
            }
        };
    });
{'fraction_non_alphanumeric': 0.13994910941475827, 'fraction_numerical': 0.0, 'mean_word_length': 1.3683304647160068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3677213', 'n_tokens_mistral': 700, 'n_tokens_neox': 666, 'n_words': 109}