PageSourceSearch

https://social.brussels/app/visitor/login/forgot-password/forgot-password.controller.js

js social.brussels collected 2026-10-02 15:40:06 UTC 3,417 bytes, 73 lines download raw bytes

1'use strict';
2
3(function(angular) {
4    angular.module('BruSo.visitor').controller('ForgotPasswordController',
5            [ '$location', '$scope', '$sce', 'A11n', 'User', 'notify', '$translate',  function($location, $scope, $sce, A11n, User, notify, $translate) {
6
7            	$scope.forgotPasswordData = {
8                        username : undefined,
9                        captchaCode : undefined
10                };
11            	
12                $scope.captcha = undefined;
13                $scope.unknownUsername = false;
14                $scope.invalidCaptchaCode = false;
15
16                $scope.usernameChanged = usernameChanged;
17                $scope.captchaCodeChanged = captchaCodeChanged;
18                $scope.forgotPassword = forgotPassword;
19
20                $translate('login.forgotPassword.mailSent').then(function (translatedValue) {
21             		$scope.mailSuccessfullySent = translatedValue;
22                 });
23
24                
25                init();
26          
27                function init() {
28                    // Initializes captcha
29                    User.getCaptcha().then(function(captcha) {
30                        $scope.captcha = $sce.trustAsHtml(captcha.data);
31                    })
32                }
33
34                function forgotPassword() {
35                    // Fill the hidden input value with the one found in the form
36                    var captchaId = angular.element('#BDC_VCID_captcha').attr('value');
37
38                    User.forgotPassword($scope.forgotPasswordData, captchaId).then(function () {
39                    	notify({
40                            message: $scope.mailSuccessfullySent,
41                            classes: "alert-success",
42                            position: "right",
43                            duration: 2000
44                        });
45                        angular.element('#forgotPasswordModal').modal('hide');
46                    }).catch(function (response) {
47                        for (var i = 0; i < response.data.exceptions.length; i++) {
48                            var exception = response.data.exceptions[i];
49                            console.log("Parameter : " + exception.parameter + ", description : " + exception.description);
50                            if (exception.parameter == 'username' && exception.description == 'unknown') {
51                                $scope.unknownUsername = true;
52                            } else if (exception.parameter == 'captchaCode' && exception.description == 'invalid') {
53                                $scope.invalidCaptchaCode = true;
54                            }
55                            // Ignore other exceptions, as they are already handled by angular validation
56                        }
57                        A11n.announceErrorAndFocus('form.invalid', 'username');
58                    });
59                }
60
61                // Hide error messages on change
62                function usernameChanged() {
63                    if ($scope.unknownUsername) {
64                        $scope.unknownUsername = false;
65                    }
66                }
67                function captchaCodeChanged() {
68                    if ($scope.invalidCaptchaCode) {
69                        $scope.invalidCaptchaCode = false;
70                    }
71                }
72            } ]);
73})(angular);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.