Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect back if not authorized #192

Merged

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented May 20, 2020

This is a continuation of solidusio/solidus#3118 and tries to redirect back when there's an authentication error.

After this is merged I think we can safely merge the one in core as well.

I updated this PR in order to use the preference introduced by the above core PR. Now the new behavior will be only supported on newer versions of Solidus, if that preference will be explicitly changed.

@kennyadsl kennyadsl self-assigned this May 20, 2020
@kennyadsl kennyadsl force-pushed the kennyadsl/redirect-back-if-not-authorized branch from 0e2de4a to 6556de3 Compare May 20, 2020 15:15
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennyadsl thank you 👍

@kennyadsl kennyadsl force-pushed the kennyadsl/redirect-back-if-not-authorized branch from 6556de3 to e12636e Compare May 21, 2020 09:42
@aldesantis
Copy link
Member

@kennyadsl is this okay to merge?

@kennyadsl
Copy link
Member Author

Not yet, with @jarednorman we found a way to avoid the major bump after this PR, see solidusio/solidus#3118 (comment)

@kennyadsl kennyadsl added the WIP label Jun 11, 2020
@kennyadsl kennyadsl force-pushed the kennyadsl/redirect-back-if-not-authorized branch 4 times, most recently from 4e5a2dc to 3a639e0 Compare October 6, 2020 13:17
@kennyadsl
Copy link
Member Author

@spaghetticode @aldesantis can you review again here, please?

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennyadsl thanks for the detailed explanation in the commit 👍

@kennyadsl
Copy link
Member Author

I noticed that the deprecation warning is emitted also on old versions that do not have the preference yet. Going to push a fix for that.

@kennyadsl kennyadsl force-pushed the kennyadsl/redirect-back-if-not-authorized branch from 3a639e0 to 10df4ee Compare October 7, 2020 05:19
Only when the `redirect_back_on_unauthorized` preference
exists and is set to true.

This preference has been introduced in core with solidusio/solidus#3118
and we can rely on that preference to drive the behavior change here
as well.

The extra

	if Spree::Config.respond_to?(:redirect_back_on_unauthorized)

check might seem useless but it's needed to avoid printing this
deprecation warning on Solidus versions that still do not have
the preference.

If the Solidus verion used does not have the preference yet, the old
behavior will be preserved.
@kennyadsl kennyadsl force-pushed the kennyadsl/redirect-back-if-not-authorized branch from 10df4ee to ff57ff5 Compare October 7, 2020 08:29
@kennyadsl kennyadsl merged commit a9a7a80 into solidusio:master Oct 7, 2020
@kennyadsl kennyadsl deleted the kennyadsl/redirect-back-if-not-authorized branch October 7, 2020 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants