diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index af20152b6..0531b60de 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -2,6 +2,17 @@ # Devise controller to handle validation of email addresses class ConfirmationsController < Devise::ConfirmationsController + + # POST /resource/confirmation + def create + self.resource = resource_class.send_confirmation_instructions(resource_params) + yield resource if block_given? + + if successfully_sent?(resource) + respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name)) + end + end + # The path used after confirmation. def after_confirmation_path_for(_resource_name, resource) signed_in_root_path(resource) diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 1bdd0e19e..285e87e3c 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -9,8 +9,6 @@ class PasswordsController < Devise::PasswordsController if successfully_sent?(resource) respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) - else - head 404 end end diff --git a/app/frontend/src/javascript/controllers/application.js b/app/frontend/src/javascript/controllers/application.js index 723c4dcbb..93d9e6c1e 100644 --- a/app/frontend/src/javascript/controllers/application.js +++ b/app/frontend/src/javascript/controllers/application.js @@ -504,14 +504,8 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { $scope.user = { email: '' }; $scope.sendReset = function () { - $scope.alerts = []; return $http.post('/users/password.json', { user: $scope.user }).then(function () { $uibModalInstance.close(); - }).catch(function () { - $scope.alerts.push({ - msg: _t('app.public.common.your_email_address_is_unknown'), - type: 'danger' - }); }); }; }] @@ -526,14 +520,8 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { $scope.user = { email: '' }; $scope.submitConfirmationNewForm = function () { - $scope.alerts = []; return $http.post('/users/confirmation.json', { user: $scope.user }).then(function () { $uibModalInstance.close(); - }).catch(function (res) { - $scope.alerts.push({ - msg: res.data.errors.email[0], - type: 'danger' - }); }); }; }] diff --git a/app/frontend/templates/shared/ConfirmationNewModal.html b/app/frontend/templates/shared/ConfirmationNewModal.html index ae131353f..e183e6928 100644 --- a/app/frontend/templates/shared/ConfirmationNewModal.html +++ b/app/frontend/templates/shared/ConfirmationNewModal.html @@ -4,7 +4,6 @@

{{ 'app.public.common.confirm_my_account' }}