-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(account invitation): accomplish sign up before accepting the invitation #30
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,8 +4,15 @@ class AcceptAccountInvitationsController < ApplicationController | |||||||||||||||
def show | ||||||||||||||||
return if user_signed_in? | ||||||||||||||||
|
||||||||||||||||
session[:after_sign_in_url] = request.fullpath | ||||||||||||||||
redirect_to new_user_session_url(email: AccountInvitation.find_by!(token: ps.fetch(:token)).email) | ||||||||||||||||
session[:after_authentication_url] = request.fullpath | ||||||||||||||||
|
||||||||||||||||
invitee_email = AccountInvitation.find_by!(token: ps[:token]).email | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If the |
||||||||||||||||
user = User.find_by(email: invitee_email) | ||||||||||||||||
if user.present? | ||||||||||||||||
redirect_to new_user_session_url(email: invitee_email) | ||||||||||||||||
else | ||||||||||||||||
redirect_to new_user_registration_url(email: invitee_email) | ||||||||||||||||
end | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
it's a bit more DRY |
||||||||||||||||
end | ||||||||||||||||
|
||||||||||||||||
def update | ||||||||||||||||
|
@@ -16,6 +23,6 @@ def update | |||||||||||||||
private | ||||||||||||||||
|
||||||||||||||||
helper_method memoize def received_invitation | ||||||||||||||||
AccountInvitation.unaccepted.for(current_user).find_by!(token: ps.fetch(:token)) | ||||||||||||||||
AccountInvitation.unaccepted.for(current_user).find_by!(token: ps[:token]) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what was the problem with the previous implementation? revert it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... ok, I've seen the main idea of the |
||||||||||||||||
end | ||||||||||||||||
end |
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.
Why changed the key
:after_sign_in_url
to:after_authentication_url
?:after_authentication_url
is longer, harder to write and spell.