Skip to content

Store original location to return to after signin#360

Merged
erdgeist merged 19 commits intofrab:masterfrom
erdgeist:return-to-after-signin
Nov 7, 2019
Merged

Store original location to return to after signin#360
erdgeist merged 19 commits intofrab:masterfrom
erdgeist:return-to-after-signin

Conversation

@erdgeist
Copy link
Contributor

Looks like devise has had a mechanism to return to the originally requested resource after sign in, as described here:

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-back-to-current-page-after-sign-in,-sign-out,-sign-up,-update

So for root and the direct cfp sign in urls this patch sticks to the old logic of redirecting users to their edit profile page (why is that, btw) and for all other cases return to the original resource (as would come in handy with join-token uris).

@manno
Copy link
Member

manno commented Oct 22, 2017

I think the redirect to the 'edit profile' page is a leftover of the old CfP logic, trying to ensure speakers edit their profile before submitting a talk. Providing a linear flow through the submission (register, profile, submit talk). We probably shouldn't redirect if there is already a profile from previous submissions.

But why did the 'return' break the tests? I thought it has to return the goto url instead of 'root_url'?

@erdgeist
Copy link
Contributor Author

Looks like there's an integration test that checks for users being redirected to the cfp page after they sign up. I forgot the return in my final commit, so the return seems to break the test.

This means after I figured out where the user should finally be redirected to, I should update the test to reflect the change.

@manno
Copy link
Member

manno commented Oct 22, 2017

I think the cfp user should still be redirected to the profile page for the first time after sign up.

@erdgeist
Copy link
Contributor Author

Currently, they are also constantly nagged to enter their availabilities, even when the view doesn't exactly indicate, how.

I saw that you can redirect after sign-up, but what we actually need the direct after the confirm, right?

https://stackoverflow.com/questions/8003347/overriding-devise-after-sign-up-path-for-not-working

@manno
Copy link
Member

manno commented Oct 22, 2017

Yes, since we use confirmable in the users model. So the availabilities button is missing from the view?

@erdgeist
Copy link
Contributor Author

@erdgeist
Copy link
Contributor Author

Found out, why the flash stays there: If you want to alert on the current view and not in the redirect, you need to set the flash.now variable, not the flash. So in app/controllers/cfp/people_controller.rb it must read

  flash.now[:alert] = t('cfp.specify_availability')

Will look for more instances and then commit.


def after_sign_in_path_for(resource)
goto = stored_location_for(resource)
return goto if not goto.blank?

Choose a reason for hiding this comment

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

return goto if goto.present?

@artemasmith
Copy link

Excuse me, @erdgeist, why don't you squash commits for PR? IMHO, it's easier to find and revert changes, when 1 PR = 1 commit.

Since the welcome controller is not very useful once you're logged in, it now redirects to the appropriate page:

* the edit profile page, if public_name still is user.email
* the cfp user page that shows your events and allows adding or joining new events, if your proifle has been filled
* the conference management page for crew

The sign_in now redirects back to the ressource that triggered the sign in request or to the cfp root path which
then redirects further as outlined above.

The tests have been modified accordingly and now work.
@erdgeist
Copy link
Contributor Author

@artemasmith Isn't squashing done when finally merging to master? I'm not familiar with best practises here but having work-in-progress commits visible until the feature is finished looks like a good idea.

@artemasmith
Copy link

@erdgeist I'm sorry, I didn't mention that it's still in progress. Yep, you're right, commits are squashed before PR merge.

@manno manno force-pushed the master branch 2 times, most recently from 8092e12 to 801a9f0 Compare July 19, 2018 17:09
@erdgeist
Copy link
Contributor Author

erdgeist commented Nov 6, 2019

Reviving the PR, as at the last conference there's been users complaining again about invite token URLs not working.

@eladeyal-intel can you please point me to where you managed to get the automated translations? I would want to provide them for the new flash message.

@elad-eyal
Copy link
Collaborator

@erdgeist

i18n-tasks translate-missing -f en -l de,es,fr,it,pt-BR,ru,zh

@erdgeist
Copy link
Contributor Author

erdgeist commented Nov 6, 2019

@eladeyal-intel I see, this requires a paid account. Thanks.

@elad-eyal
Copy link
Collaborator

elad-eyal commented Nov 6, 2019

@erdgeist - Maybe you can push en and de; and after this is merged I will translate the rest with this tool.

@erdgeist erdgeist merged commit d57b09c into frab:master Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants