Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5176 from withspectrum/3.1.15
Browse files Browse the repository at this point in the history
3.1.15
  • Loading branch information
brianlovin authored Jun 25, 2019
2 parents efd4e42 + fa9b102 commit 2f4fc34
Show file tree
Hide file tree
Showing 23 changed files with 323 additions and 105 deletions.
15 changes: 9 additions & 6 deletions api/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ const init = () => {
return user;
})
.catch(err => {
done(err);
return null;
return done(null, err, {
message: 'Please sign in with GitHub to create a new account.',
});
});
}
)
Expand Down Expand Up @@ -204,8 +205,9 @@ const init = () => {
return user;
})
.catch(err => {
done(err);
return null;
return done(null, err, {
message: 'Please sign in with GitHub to create a new account.',
});
});
}
)
Expand Down Expand Up @@ -268,8 +270,9 @@ const init = () => {
return user;
})
.catch(err => {
done(err);
return null;
return done(null, err, {
message: 'Please sign in with GitHub to create a new account.',
});
});
}
)
Expand Down
4 changes: 3 additions & 1 deletion api/routes/auth/create-signin-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export const createSigninRoutes = (
// redirecting to the right place and handling tokens
callbacks: [
passport.authenticate(strategy, {
failureRedirect: IS_PROD ? '/' : 'http://localhost:3000/',
failureRedirect: IS_PROD
? '/new/user'
: 'http://localhost:3000/new/user',
}),
(req: express$Request, res: express$Response) => {
// $FlowIssue
Expand Down
76 changes: 73 additions & 3 deletions cypress/integration/login_spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,72 @@
describe('Login View', () => {
describe('Sign up', () => {
beforeEach(() => {
cy.visit('/new/user');
});

it('should only allow github signup', () => {
cy.get('[data-cy="login-page"]').should('be.visible');
cy.get('[href*="/auth/github"]').should('be.visible');
cy.get('[href*="/login"]').should('be.visible');
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
'be.visible'
);
});
});

describe('Log in', () => {
beforeEach(() => {
cy.visit('/login');
});

it('should render', () => {
it('should render login methods', () => {
cy.get('[data-cy="login-page"]').should('be.visible');
cy.get('[href*="/auth/twitter"]').should('be.visible');
cy.get('[href*="/auth/facebook"]').should('be.visible');
cy.get('[href*="/auth/google"]').should('be.visible');
cy.get('[href*="/auth/github"]').should('be.visible');
cy.get('[href*="/new/user"]').should('be.visible');

cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
'be.visible'
);
});
});

describe('Community Login View', () => {
describe('Community Signup View', () => {
beforeEach(() => {
cy.visit('/spectrum/login');
});

it('should render', () => {
cy.get('[data-cy="community-login-page"]').should('be.visible');
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
'be.visible'
);

cy.get('[href*="/login?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
});
});

describe('Redirect paths', () => {
it('should preserve community redirect paths', () => {
cy.visit('/spectrum/login');
cy.get('[data-cy="community-login-page"]').should('be.visible');
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
'be.visible'
);

cy.get('[href*="/login?r=http://localhost:3000/spectrum"]')
.should('be.visible')
.click();

cy.get('[href*="/auth/twitter?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
Expand All @@ -34,8 +79,33 @@ describe('Community Login View', () => {
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
cy.get('[href*="/new/user?r=http://localhost:3000/spectrum"]').should(
'be.visible'
);
});

it('should preserve thread redirect paths', () => {
const path =
'http://localhost:3000/spectrum/general/yet-another-thread~thread-3';
cy.visit(path);
cy.get('[data-cy="join-community-chat-upsell"]')
.should('be.visible')
.click();

cy.get('[data-cy="login-modal"]').should('be.visible');
cy.get(`[href*="/auth/github?r=${path}"]`).should('be.visible');
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
'be.visible'
);

cy.get(`[href*="/login?r=${path}"]`)
.should('be.visible')
.click();

cy.get(`[href*="/auth/twitter?r=${path}"]`).should('be.visible');
cy.get(`[href*="/auth/facebook?r=${path}"]`).should('be.visible');
cy.get(`[href*="/auth/google?r=${path}"]`).should('be.visible');
cy.get(`[href*="/auth/github?r=${path}"]`).should('be.visible');
cy.get(`[href*="/new/user?r=${path}"]`).should('be.visible');
});
});
2 changes: 1 addition & 1 deletion cypress/integration/navbar_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const coreSplashPageNavbarLinksVisible = () => {

const checkSignedOutSplashNavbarLinksRender = () => {
coreSplashPageNavbarLinksVisible();

cy.get('[data-cy="navigation-splash-login"]').should('be.visible');
cy.get('[data-cy="navigation-splash-signin"]').should('be.visible');
};

Expand Down
10 changes: 10 additions & 0 deletions docs/operations/hourly-backups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Hourly Off-site Backups

In order to avoid more data loss we implemented hourly off-site backups in [#5150](https://github.com/withspectrum/spectrum/pull/5150). While the implementation is simple, it should cover us well enough.

It works by running two cron jobs:

1. Runs at 30 minutes past every hour and triggers an "on-demand backup" with our database host (Compose)
2. Runs at 0 minutes past every hour, fetches the latest "on-demand backup" from our database host and uploads it to our S3 bucket

To access the latest hourly backup you can either go to the Compose dashboard (app.compose.com), navigate to the RethinkDB deployment and download the newest on-demand backup, or open our S3 bucket and download the latest one from there.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Spectrum",
"version": "3.1.14",
"version": "3.1.15",
"license": "BSD-3-Clause",
"devDependencies": {
"@babel/preset-flow": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions shared/analytics/event-types/page-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export const HOME_PAGE_VIEWED = 'Home Page Viewed';
export const HOME_PAGE_JOIN_SPECTRUM_CLICKED = 'Home Page Join Spectrum Clicked';
export const HOME_PAGE_CREATE_COMMUNITY_CLICKED = 'Home Page Create Community Clicked';
export const HOME_PAGE_SIGN_IN_CLICKED = 'Home Page Sign In Clicked';
export const HOME_PAGE_LOG_IN_CLICKED = 'Home Page Log In Clicked';
export const HOME_PAGE_EXPLORE_CLICKED = 'Home Page Explore Clicked';
export const HOME_PAGE_EXAMPLE_CONVERSATION_CLICKED = 'Home Page Example Conversation Clicked';
6 changes: 5 additions & 1 deletion shared/db/queries/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ export const createOrFindUser = (user: Object, providerMethod: string): Promise<
if (storedUser && storedUser.id) {
return Promise.resolve(storedUser);
}


// restrict new signups to github auth only
if (providerMethod !== 'githubProviderId') return Promise.resolve(null)
// if no user exists, create a new one with the oauth profile data
return storeUser(user);
})
Expand All @@ -233,6 +235,8 @@ export const createOrFindUser = (user: Object, providerMethod: string): Promise<
console.error(err);
return null;
}

if (providerMethod !== 'githubProviderId') return null
return storeUser(user);
});
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/fullscreenView/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const FullscreenViewContainer = styled.div`
justify-content: flex-start;
flex-direction: column;
z-index: ${zIndex.fullscreen};
overflow-y: scroll;
overflow-y: auto;
-webkit-transform: translate3d(0, 0, 0);
`;

Expand Down
2 changes: 1 addition & 1 deletion src/components/loginButtonSet/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const FacebookSigninButton = (props: ButtonProps) => {
<A onClick={() => onClickHandler && onClickHandler('facebook')} href={href}>
<FacebookButton showAfter={showAfter} preferred={preferred}>
<Icon glyph={'facebook'} />
<Label>Sign in with Facebook</Label>
<Label>Log in with Facebook</Label>
</FacebookButton>
</A>
);
Expand Down
10 changes: 7 additions & 3 deletions src/components/loginButtonSet/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import { GithubButton, Label, A } from './style';
import Icon from 'src/components/icon';

export const GithubSigninButton = (props: ButtonProps) => {
const { href, preferred, showAfter, onClickHandler } = props;
const { href, preferred, showAfter, onClickHandler, githubOnly } = props;

return (
<A onClick={() => onClickHandler && onClickHandler('github')} href={href}>
<A
githubOnly={githubOnly}
onClick={() => onClickHandler && onClickHandler('github')}
href={href}
>
<GithubButton showAfter={showAfter} preferred={preferred}>
<Icon glyph={'github'} />
<Label>Sign in with GitHub</Label>
<Label>{githubOnly ? 'Sign up' : 'Log in'} with GitHub</Label>
</GithubButton>
</A>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/loginButtonSet/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const GoogleSigninButton = (props: ButtonProps) => {
<A onClick={() => onClickHandler && onClickHandler('google')} href={href}>
<GoogleButton showAfter={showAfter} preferred={preferred}>
<Icon glyph={'google'} />
<Label>Sign in with Google</Label>
<Label>Log in with Google</Label>
</GoogleButton>
</A>
);
Expand Down
Loading

0 comments on commit 2f4fc34

Please sign in to comment.