-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: Incompatible __client_uat & __session should show interstitial #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
lib/clerk/rack_middleware_v2.rb
Outdated
if production? && client_uat.nil? | ||
return signed_out(env) | ||
# Show interstitial when there is no client_uat or cookie token | ||
if (client_uat == "0" || client_uat.nil?) && cookie_token.to_s.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ That's the signed-out client_uat
value, right? Just noting in case we need to update the comment accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the client_uat == "0"
refers to the signed-out state. I updated the code and the comment since it was incorrect to use that. The case here is to render interstitial when there is no client_uat and cookie token information.
|
||
# Show interstitial when there is client_uat is incompatible with cookie token | ||
has_cookie_token_without_client = (client_uat == "0" || client_uat.nil?) && cookie_token | ||
has_client_without_cookie_token = (client_uat.to_s != "0" || client_uat.to_s != "") && cookie_token.to_s.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Where does the client_uat.to_s != ""
case correspond here to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it corresponds to the case where the client_uat
is missing or the value is somehow removed. We could use the client_uat.nil?
if that makes it more readable but i think this check is safer because it also applies to cases where the client_uat exists without value (due to some edge-case or extension or something).
lib/clerk/rack_middleware_v2.rb
Outdated
return unknown(interstitial: true) if has_cookie_token_without_client || has_client_without_cookie_token | ||
|
||
# Show interstitial when there is client_uat is incompatible with cookie token | ||
if (client_uat == "0" || client_uat.nil?) && cookie_token.to_s.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Same check as in line 174 could be assigned to a variable? Just for aggregating the cases at a single location maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have updated that :)
8dfcca3
to
f4954be
Compare
f4954be
to
dcad415
Compare
dcad415
to
6d8dc34
Compare
Handle 2 interstitial cases:
client_uat
andcookie token
info (both for dev and production apps)client_uat
has a value that does not match with thecookie token
value