Sha256: 833c41942087efd8fe93341c11da9edb677de5d9ff80eec0914466a6e1505d61
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module Decidim module Devise # This controller customizes the behaviour of Devise::Invitiable. class InvitationsController < ::Devise::InvitationsController include Decidim::DeviseControllers before_action :configure_permitted_parameters # We don't users to create invitations, so we just redirect them to the # homepage. def authenticate_inviter! redirect_to root_path end # Overwrite the method that returns the path after a user accepts an # invitation. Using the param `invite_redirect` we can redirect the user # to a custom path after it has accepted the invitation. def after_accept_path_for(resource) params[:invite_redirect] || after_sign_in_path_for(resource) end # When a managed user accepts the invitation is promoted to non-managed user. def accept_resource resource = resource_class.accept_invitation!(update_resource_params) resource.update!(managed: false) if resource.managed? resource end protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:accept_invitation, keys: [:nickname]) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems