Repository navigation
Preferences sign in flow - #961
Conversation
|
Do I need to update my PR, #903, to use your new SignInStore? |
@iAmWillShepherd I'm reviewing that PR now. The most obvious thing is that our |
iAmWillShepherd
left a comment
There was a problem hiding this comment.
I noticed that in some places private methods come first and in other places they are last. I don't have a preference so long as it's consistently one way or the other.
| * If an error occurs during sign in (such as invalid credentials) | ||
| * the authentication state will be updated with that error so that | ||
| * the responsible component can present it to the user. | ||
| */ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| if (response.verifiable_password_authentication === false) { | ||
| authMethods.delete(AuthenticationMethods.BasicAuth) | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| return authMethods | ||
| } else { | ||
| throw new Error('Unsupported Enterprise server') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| private getForgotPasswordURL(endpoint: string): string { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } catch (e) { | ||
| let error = e | ||
| if (e.name === InvalidURLErrorName) { | ||
| error = new Error(`The Enterprise server address doesn't appear to be a valid URL. We're expecting something like https://github.example.com.`) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const state = this.props.signInState | ||
| const stepText = this.props.signInState.kind | ||
|
|
||
| if (state.kind === SignInStep.EndpointEntry) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
| default: return assertNever(response, `Unknown response: ${response}`) | ||
| } | ||
| const error = this.props.error |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } else { | ||
| primaryButtonText = 'Sign in' | ||
| } | ||
| tabIndexPrimary = 4 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| <div className='horizontal-rule'><span className='horizontal-rule-content'>or</span></div> | ||
| </Row> | ||
| <Row className='sign-in-with-browser'> | ||
| <LinkButton tabIndex={3} className='link-with-icon' onClick={this.onSignInWithBrowser}> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (this.props.signInState.kind !== nextProps.signInState.kind) { | ||
| // ...and changes to success | ||
| if (nextProps.signInState.kind === SignInStep.Success) { | ||
| this.advanceToStep(WelcomeStep.ConfigureGit) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
GHE always supports OAuth so we can reduce this logic to whether it supports basic auth or not. At least until there's other auth methods we need to support
I don't believe we've settled on any guideline for ordering of methods based on visibility and I think it's pretty much all over the place in many of our components at the moment. I personally don't feel strongly about ordering after visibility, it's never felt important to me but I can defer to the collective if there's a strong will (cc @desktop/core for feels). If we do decide that visibility order is important to us I do think it should be addressed separate from this PR and enforced using tslint rules. |
This is the only bit of enforcement we currently do: And there's more options we can provide so I think it's worth a discussion later to see what feels natural (I don't want us going down the StyleCop path and being annoyingly rigorous). |
|
@shiftkey TS Lint is already annoyingly rigorous. 😏 |
|
🐐 |
This moves the sign in flow from being inline in the preferences dialog to being its own dialog. As part of this work, and after discussing this in depth with @joshaber, I've moved the sign in logic out of the sign in components and into a specialized store, the
SignInStore. All work to add a .com or Enterprise user is now done through the dispatcher. This lets us disconnect our sign in views in the welcome flow from that of the preferences (and in the future that of the publish foldout).Fixes #840, #957, #976