Skip to content

Refactoring : Confirmations controller - useless if redirect_url condition #1611

Open
@newfylox

Description

@newfylox

Version: 1.2.2

in this section

if redirect_url
redirect_to DeviseTokenAuth::Url.generate(redirect_url, account_confirmation_success: false)
else
raise ActionController::RoutingError, 'Not Found'
end

I was wondering why we are checking if redirect_url because it's necessary of having DeviseTokenAuth.default_confirm_success_url or params[:redirect_url] set.

In other words, imagine having this method returning nil

def redirect_url
params.fetch(
:redirect_url,
DeviseTokenAuth.default_confirm_success_url
)
end

It means that the sign_up flow would failed in this section
redirect_to_link = signed_in_resource.build_auth_url(redirect_url, redirect_headers)
else
redirect_to_link = DeviseTokenAuth::Url.generate(redirect_url, redirect_header_options)
end

and throw an exception of type ArgumentError saying bad argument (expected URI object or URI string).

Maybe I missed something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions