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

Signup: Desktop: Show signup in desktop when logged out #2813

Closed
wants to merge 3 commits into from

Conversation

scruffian
Copy link
Member

WIP. This is just a very quick commit to demonstrate some changes needed to show the signup in the desktop app.

This will fix #2960 eventually.

@scruffian scruffian added [Status] In Progress [Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. labels Jan 26, 2016
@scruffian scruffian self-assigned this Jan 26, 2016
@@ -186,7 +186,7 @@ function boot() {
analytics.setSuperProps( superProps );

if ( config.isEnabled( 'oauth' ) ) {
LoggedOutLayout = require( 'layout/logged-out-oauth' );
LoggedOutLayout = require( 'layout/logged-out' );
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to display two different layout styles before the user logs in, based on the whether or not the user is on /login or /start. The only way I can think to accomplish this is to update LoggedOutLayout to display both styles based on whether or not props.section === 'signup'.

This could be wrong, but I don't believe we can use two separate layouts here, because switching would wipe out #primary, which is what we render the other faux-top-level React components into.

@drewblaisdell
Copy link
Contributor

  • The endpoints we use in signup before the bearer token is returned need to be updated to respond to localhost:41050.
  • We need to change the style of the layout, as you mentioned (with one possible solution described here).
  • Once the bearer token is received, we'll need to save it with OAuthToken#setToken, and redirect to an internal route (possibly forcing a reload) instead of through wp-login.php.

@drewblaisdell
Copy link
Contributor

There are a few other issues we need to deal with here:

  • If we avoid fully reloading the page (as happens now with wp-login.php), we need to change the way sections.js handles logged in/out routes. Right now, we dead-end any section without a true enableLoggedOut property, which is why the post-signup redirect to checkout fails with no error.
  • We need to force a fetch on the user, and update Layout to rerender when the user changes.
  • Once the bearer token is retrieved during account creation in signup, it is used to authenticate subsequent requests, along with an OAuth ID/key configured for use in signup. This currently breaks all requests after the bearer token is retrieved in the desktop environment, because the signup OAuth account does not give access to the host/port used by the desktop app (127.0.0.1:41050).

We might be able to split this into two PRs (one that enables signup in the desktop app, and another that obviates the full page reload at the end of signup) if we address just the third point above. What do you think?

@drewblaisdell
Copy link
Contributor

Actually, we could break this down one PR further, by updating Calypso to use the OAuth token, but still triggering a new page load after signup. This would allow us to make the changes to the layout/sections.js separately. The PRs related to bypassing wp-login.php in signup would then be:

  • Enable signup in the desktop app (Signup: Enable signup in the desktop app #3221).
  • Set the OAuth token during signup with OAuthToken.setToken, don't redirect through wp-login.php but still trigger a new page load at the end of signup. We'd need to update this module to replicate the behavior of wp-login.php and use secure cookies.
  • Update Layout/sections.js.

@fabianapsimoes
Copy link
Contributor

#2960 was fixed in #2964. Feel free to reopen this PR if needed.

@lancewillett lancewillett deleted the fix/signup-in-desktop branch May 26, 2016 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout: Use a single layout component
4 participants