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

Implements a seamless login flow that remembers your last sign in scope #291

Merged
merged 7 commits into from
May 10, 2016

Conversation

rauhryan
Copy link
Member

@rauhryan rauhryan commented May 10, 2016

Closes #168
Closes #172
Closes huboard/huboard#624

@dahlbyk dahlbyk temporarily deployed to huboard-rails-pr-291 May 10, 2016 13:46 Inactive
@@ -76,6 +76,8 @@
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

config.middleware.use Rack::Attack
Copy link
Member

Choose a reason for hiding this comment

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

Why move?

Copy link
Member Author

Choose a reason for hiding this comment

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

I cleans up the logs for development.

Don't really need the log noise while I'm developing.

Sorry I threw that in there, just felt compeled

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

Probably a trivial fix that's worth just including here, but https://huboard-rails-pr-291.herokuapp.com/dashboard throws a 500 if you're not authenticated. Should challenge for auth.

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

Is there anything we can do about this?
chrome_2016-05-10_10-21-13

Repro:

  1. /login/private
  2. /login/public
  3. Note public-only warning, even though private repo is visible.

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

Also, thoughts on directing the Private tab to /login/private instead of disabling it?

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

A few other questions, just thinking through edge cases:

  1. What's the value of keeping both /login and /welcome? Should /login redirect to /login/github?
  2. Should /welcome redirect to /dashboard if a non-default scope is available?

Really just trying to think through how we could completely shut down access routes to weird states.

@discorick
Copy link
Member

discorick commented May 10, 2016

Also, thoughts on directing the Private tab to /login/private instead of disabling it?

I played with it originally, but it is a deceiving UX. I.E:

  • User is in public only
  • User wants to see private too so they click private tab
  • GitHub upgrades Oauth to private
  • User is redirected to private repo only filter... wonders what happened to their public repos

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

I played with it originally, but it is a deceiving UX.

👍

@dahlbyk dahlbyk temporarily deployed to huboard-rails-pr-291 May 10, 2016 18:45 Inactive
@rauhryan
Copy link
Member Author

@dahlbyk new push addresses your edge cases.

I think we are ready to 🚢

@discorick
Copy link
Member

Just one minor UX nitpick if you think its worth it, we could probably move everything closer to the top of the browser on welcome:

image

@rauhryan
Copy link
Member Author

Just one minor UX nitpick if you think its worth it, we could probably move everything closer to the top of the browser on welcome:

Nitpick noted.

I'm going to leave it for now, I'm good to ship the way it is

Anything else before we 🚢?

@discorick
Copy link
Member

discorick commented May 10, 2016

It may be worth implementing @dahlbyk 's suggestion that if there is a private or publics scope already, /welcome should redirect to /dashboard

This would effectively block users from reaching bad states from scope downgrades.

Otherwise I think it's 🚢

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

I can still reproduce #291 (comment) if I have authorized private and hit /login/public (via /login).

Also noticed that if the app is revoked, /dashboard redirects to /login.

@rauhryan
Copy link
Member Author

Also noticed that if the app is revoked, /dashboard redirects to /login.

This is because Ghee::Unauthorized will log you out and redirect to /login, I can easily change this behavior... ref: https://github.com/huboard/huboard-web/blob/master/app/controllers/application_controller.rb#L13-L19

I can still reproduce #291 (comment) if I have authorized private and hit /login/public (via /login).

We can still ship, knowing that "could" happen.

Currently there is only one scenario where the application redirects or links to /login

I'm not ready to completely kill /login, I'd like to keep it around in case we need to bring it back.

I think the question is:

  1. What's the risk or do we care if users "url hack" the /login route?
  2. Are we ok to ship, knowing there are edge cases that can get you into a weird state?

If someone gets into a funky state, the solution is...

/logout => /login/github

The user will be taken to either /welcome or /dashboard where there are links to upgrade access that will fix it.

Without adding datastore or switch auth frameworks, I don't think there is a perfect solution.

My vote is:

Make a decision on how we handle Ghee::Unauthorized and ship it

@discorick
Copy link
Member

Make a decision on how we handle Ghee::Unauthorized

Just to send users to /login/github ?

@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

I'm not ready to completely kill /login, I'd like to keep it around in case we need to bring it back.

That's why we have Git. 😉

But seriously, life gets simpler if we make /login redirect to /login/github. We can easily remove the redirect if /login needs to come back.

With that plus a /welcome to /dashboard redirect I think we are more than sufficiently buttoned up. I just don't want to have to revisit this again for a long time.

@rauhryan
Copy link
Member Author

OK! I've added the requested changes.

Let's 🚢 this bad boy!

@dahlbyk dahlbyk merged commit dcdab09 into master May 10, 2016
@dahlbyk
Copy link
Member

dahlbyk commented May 10, 2016

👏 ✨ 👏 Excellent work!

This was referenced May 13, 2016
@dahlbyk dahlbyk deleted the rauhryan/login-flow-final branch May 26, 2016 15:56
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