Skip to content

Preferences sign in flow - #961

Merged
iAmWillShepherd merged 127 commits into
masterfrom
preferences-sign-in-flow
Mar 3, 2017
Merged

iAmWillShepherd merged 127 commits into
masterfrom
preferences-sign-in-flow

Conversation

@niik

@niik niik commented Feb 20, 2017 •

Copy link
Copy Markdown
Member

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

niik added 30 commits February 9, 2017 17:04
@iAmWillShepherd

Copy link
Copy Markdown
Contributor

Do I need to update my PR, #903, to use your new SignInStore?

@niik

niik commented Feb 27, 2017

Copy link
Copy Markdown
Member Author

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 PopupType.SignIn's will clash but I think we can address that separately in #903. I'll follow up in the review

@iAmWillShepherd
iAmWillShepherd self-requested a review February 27, 2017 19:21

@iAmWillShepherd iAmWillShepherd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.


if (response.verifiable_password_authentication === false) {
authMethods.delete(AuthenticationMethods.BasicAuth)
}

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/dispatcher/sign-in-store.ts Outdated

return authMethods
} else {
throw new Error('Unsupported Enterprise server')

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/dispatcher/sign-in-store.ts Outdated
}
}

private getForgotPasswordURL(endpoint: string): string {

This comment was marked as spam.

Comment thread app/src/lib/dispatcher/sign-in-store.ts Outdated
} 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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/lib/sign-in.tsx Outdated
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.

}
default: return assertNever(response, `Unknown response: ${response}`)
}
const error = this.props.error

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/sign-in/sign-in.tsx Outdated
} else {
primaryButtonText = 'Sign in'
}
tabIndexPrimary = 4

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/sign-in/sign-in.tsx Outdated
<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.

Comment thread app/src/ui/welcome/welcome.tsx Outdated
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.

@niik

niik commented Mar 1, 2017

Copy link
Copy Markdown
Member Author

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.

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.

@shiftkey

shiftkey commented Mar 1, 2017

Copy link
Copy Markdown
Member

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.

This is the only bit of enforcement we currently do:

    "member-ordering": [
      true,
      "static-before-instance",
      "variables-before-functions"
    ],

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).

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

@shiftkey TS Lint is already annoyingly rigorous. 😏

@niik

niik commented Mar 2, 2017

Copy link
Copy Markdown
Member Author

🐐

@iAmWillShepherd
iAmWillShepherd merged commit c84af6d into master Mar 3, 2017
@iAmWillShepherd
iAmWillShepherd deleted the preferences-sign-in-flow branch March 3, 2017 15:59
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