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

Switch to AuthView on Publish API Failure #300

Merged
merged 42 commits into from Nov 3, 2017

Conversation

@StanleyGoldman
Copy link
Member

StanleyGoldman commented Sep 11, 2017

Currently our only exposure to the API is PublishView. In the event of an authentication failure we need to switch the PublishView to the AuthenticationView

  • If the user's authentication is not who we expect
    img

-If there is no authentication present
img

  • Sign In vs Publish
    img

Depends on:

@StanleyGoldman
Copy link
Member Author

StanleyGoldman commented Sep 12, 2017

Do we need message to explain to the user that we need your authentication?
@shana @donokuda

@donokuda
Copy link
Member

donokuda commented Sep 12, 2017

Do we need message to explain to the user that we need your authentication?

Yup, I'm 👍 in favor of explaining why they're taken to the authentication screen. Any strong feelings about checking first if they're signed in before displaying the publish form? If they're not logged in, then we could show them the sign-in form with a little error up on top:

I can push up an example branch if that helps!

@StanleyGoldman
Copy link
Member Author

StanleyGoldman commented Sep 12, 2017

Cool. Thanks for the draft.
I think I got it, I'll let you know if I need more.

@StanleyGoldman StanleyGoldman force-pushed the fixes/api-failure-switch-auth-view branch from dc579f2 to 90d1f0c Sep 12, 2017
… we get from the api
…re-switch-auth-view
…counts
…ting specific views
…hed username
…e-switch-auth-view
…e-switch-auth-view
StanleyGoldman and others added 2 commits Oct 16, 2017
…e-switch-auth-view
Use default padding settings
@donokuda
Copy link
Member

donokuda commented Oct 17, 2017

Added back the header styles:

…e-switch-auth-view
var usernameMismatchException = exception as TokenUsernameMismatchException;
if (usernameMismatchException != null)
{
message = "Your credentials need to be refreshed";

This comment has been minimized.

@shana

shana Oct 19, 2017

Contributor

Been thinking about this some more and talking to some people about what messages should say, and we should probably explain a bit more why we're doing this.

How about:

We've detected that your stored credentials are out of sync with your current user. This can happen if you have signed in to git outside of Unity. Sign in again to refresh your credentials.

This comment has been minimized.

@StanleyGoldman

StanleyGoldman Oct 19, 2017

Author Member

That sounds much better.


if (usernameMismatchException == null && keychainEmptyException == null)
{
message = "There was an error validating your account";

This comment has been minimized.

@shana

shana Oct 19, 2017

Contributor

All of these messages should be in const fields somewhere so we can localize them later


if (usernameMismatchException == null && keychainEmptyException == null)
{
message = "There was an error validating your account";

This comment has been minimized.

@shana

shana Oct 19, 2017

Contributor

I feel like this message is a bit unhelpful, especially given that it's the first thing they see right after clicking the button. When does this happen and is this our fault or the users'? If it's our fault, then we should followup with "Please sign in again" to tell them how to proceed here.

This comment has been minimized.

@StanleyGoldman

StanleyGoldman Oct 19, 2017

Author Member

It actually hasn't happened to me yet, so it would probably be best to leave the original exception message there instead.

@donokuda
Copy link
Member

donokuda commented Oct 27, 2017

Here's where this PR is at right now. It's ready for some feedback:

Sign in view with warning:

screen shot 2017-10-27 at 9 18 45 am

2FA view (is there a way to suppress that error if this is the first time viewing this screen?)

screen shot 2017-10-27 at 9 24 19 am

I also noticed when you hit "back" from the 2FA, it will still persist the error message even though it's not relevant to the screen before. Is there a way to prevent that from happening?

screen shot 2017-10-27 at 9 30 21 am

…t-objects

Preventing the exposure of Octokit objects to the codebase
@shana
Copy link
Contributor

shana commented Nov 2, 2017

I like this UI a lot, those message box styles rock!

I also noticed when you hit "back" from the 2FA, it will still persist the error message even though it's not relevant to the screen before. Is there a way to prevent that from happening?

We probably need to call Repaint/Redraw on the window to refesh the UI here

I wonder how we handle the Esc key. We should probably close the window and cancel the whole thing.

Cleanups to #300

if (shouldProceed)
{
//Proceed as current user

This comment has been minimized.

@StanleyGoldman

StanleyGoldman Nov 2, 2017

Author Member

Still need to work out what happens here..

}
else
{
//Logout current user and try again

This comment has been minimized.

@StanleyGoldman

StanleyGoldman Nov 2, 2017

Author Member

And here..

@StanleyGoldman
Copy link
Member Author

StanleyGoldman commented Nov 2, 2017

Actually... the more I look at it this code will never run, PopupWindow and AuthenticationView already has us covered on this one.

var tokenUsernameMismatchException = exception as TokenUsernameMismatchException;
if (tokenUsernameMismatchException != null)
{
Logger.Trace("Token Username Mismatch");
var shouldProceed = EditorUtility.DisplayDialog(AuthenticationChangedTitle,
string.Format(AuthenticationChangedMessageFormat,
tokenUsernameMismatchException.CachedUsername,
tokenUsernameMismatchException.CurrentUsername), AuthenticationChangedProceed, AuthenticationChangedLogout);
if (shouldProceed)
{
//Proceed as current user
}
else
{
//Logout current user and try again
}
return;
}

StanleyGoldman and others added 4 commits Nov 2, 2017
@shana
shana approved these changes Nov 3, 2017
Copy link
Contributor

shana left a comment

omgomgomgomgomg this looks so awesome! 🎉 🚀

@shana shana merged commit 4280ed4 into master Nov 3, 2017
2 checks passed
2 checks passed
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@shana shana deleted the fixes/api-failure-switch-auth-view branch Nov 3, 2017
@StanleyGoldman
Copy link
Member Author

StanleyGoldman commented Nov 7, 2017

Fixes #414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.