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

Commit 2f4fc34

Browse files
authored
Merge pull request #5176 from withspectrum/3.1.15
3.1.15
2 parents efd4e42 + fa9b102 commit 2f4fc34

File tree

23 files changed

+323
-105
lines changed

23 files changed

+323
-105
lines changed

api/authentication.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ const init = () => {
139139
return user;
140140
})
141141
.catch(err => {
142-
done(err);
143-
return null;
142+
return done(null, err, {
143+
message: 'Please sign in with GitHub to create a new account.',
144+
});
144145
});
145146
}
146147
)
@@ -204,8 +205,9 @@ const init = () => {
204205
return user;
205206
})
206207
.catch(err => {
207-
done(err);
208-
return null;
208+
return done(null, err, {
209+
message: 'Please sign in with GitHub to create a new account.',
210+
});
209211
});
210212
}
211213
)
@@ -268,8 +270,9 @@ const init = () => {
268270
return user;
269271
})
270272
.catch(err => {
271-
done(err);
272-
return null;
273+
return done(null, err, {
274+
message: 'Please sign in with GitHub to create a new account.',
275+
});
273276
});
274277
}
275278
)

api/routes/auth/create-signin-routes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export const createSigninRoutes = (
4141
// redirecting to the right place and handling tokens
4242
callbacks: [
4343
passport.authenticate(strategy, {
44-
failureRedirect: IS_PROD ? '/' : 'http://localhost:3000/',
44+
failureRedirect: IS_PROD
45+
? '/new/user'
46+
: 'http://localhost:3000/new/user',
4547
}),
4648
(req: express$Request, res: express$Response) => {
4749
// $FlowIssue

cypress/integration/login_spec.js

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,72 @@
1-
describe('Login View', () => {
1+
describe('Sign up', () => {
2+
beforeEach(() => {
3+
cy.visit('/new/user');
4+
});
5+
6+
it('should only allow github signup', () => {
7+
cy.get('[data-cy="login-page"]').should('be.visible');
8+
cy.get('[href*="/auth/github"]').should('be.visible');
9+
cy.get('[href*="/login"]').should('be.visible');
10+
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
11+
'be.visible'
12+
);
13+
});
14+
});
15+
16+
describe('Log in', () => {
217
beforeEach(() => {
318
cy.visit('/login');
419
});
520

6-
it('should render', () => {
21+
it('should render login methods', () => {
722
cy.get('[data-cy="login-page"]').should('be.visible');
823
cy.get('[href*="/auth/twitter"]').should('be.visible');
924
cy.get('[href*="/auth/facebook"]').should('be.visible');
1025
cy.get('[href*="/auth/google"]').should('be.visible');
1126
cy.get('[href*="/auth/github"]').should('be.visible');
27+
cy.get('[href*="/new/user"]').should('be.visible');
28+
1229
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
1330
'be.visible'
1431
);
1532
});
1633
});
1734

18-
describe('Community Login View', () => {
35+
describe('Community Signup View', () => {
1936
beforeEach(() => {
2037
cy.visit('/spectrum/login');
2138
});
2239

2340
it('should render', () => {
2441
cy.get('[data-cy="community-login-page"]').should('be.visible');
42+
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
43+
'be.visible'
44+
);
45+
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
46+
'be.visible'
47+
);
48+
49+
cy.get('[href*="/login?r=http://localhost:3000/spectrum"]').should(
50+
'be.visible'
51+
);
52+
});
53+
});
54+
55+
describe('Redirect paths', () => {
56+
it('should preserve community redirect paths', () => {
57+
cy.visit('/spectrum/login');
58+
cy.get('[data-cy="community-login-page"]').should('be.visible');
59+
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
60+
'be.visible'
61+
);
62+
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
63+
'be.visible'
64+
);
65+
66+
cy.get('[href*="/login?r=http://localhost:3000/spectrum"]')
67+
.should('be.visible')
68+
.click();
69+
2570
cy.get('[href*="/auth/twitter?r=http://localhost:3000/spectrum"]').should(
2671
'be.visible'
2772
);
@@ -34,8 +79,33 @@ describe('Community Login View', () => {
3479
cy.get('[href*="/auth/github?r=http://localhost:3000/spectrum"]').should(
3580
'be.visible'
3681
);
82+
cy.get('[href*="/new/user?r=http://localhost:3000/spectrum"]').should(
83+
'be.visible'
84+
);
85+
});
86+
87+
it('should preserve thread redirect paths', () => {
88+
const path =
89+
'http://localhost:3000/spectrum/general/yet-another-thread~thread-3';
90+
cy.visit(path);
91+
cy.get('[data-cy="join-community-chat-upsell"]')
92+
.should('be.visible')
93+
.click();
94+
95+
cy.get('[data-cy="login-modal"]').should('be.visible');
96+
cy.get(`[href*="/auth/github?r=${path}"]`).should('be.visible');
3797
cy.get('[href*="github.com/withspectrum/code-of-conduct"]').should(
3898
'be.visible'
3999
);
100+
101+
cy.get(`[href*="/login?r=${path}"]`)
102+
.should('be.visible')
103+
.click();
104+
105+
cy.get(`[href*="/auth/twitter?r=${path}"]`).should('be.visible');
106+
cy.get(`[href*="/auth/facebook?r=${path}"]`).should('be.visible');
107+
cy.get(`[href*="/auth/google?r=${path}"]`).should('be.visible');
108+
cy.get(`[href*="/auth/github?r=${path}"]`).should('be.visible');
109+
cy.get(`[href*="/new/user?r=${path}"]`).should('be.visible');
40110
});
41111
});

cypress/integration/navbar_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const coreSplashPageNavbarLinksVisible = () => {
1414

1515
const checkSignedOutSplashNavbarLinksRender = () => {
1616
coreSplashPageNavbarLinksVisible();
17-
17+
cy.get('[data-cy="navigation-splash-login"]').should('be.visible');
1818
cy.get('[data-cy="navigation-splash-signin"]').should('be.visible');
1919
};
2020

docs/operations/hourly-backups.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Hourly Off-site Backups
2+
3+
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.
4+
5+
It works by running two cron jobs:
6+
7+
1. Runs at 30 minutes past every hour and triggers an "on-demand backup" with our database host (Compose)
8+
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
9+
10+
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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "3.1.14",
3+
"version": "3.1.15",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"@babel/preset-flow": "^7.0.0",

shared/analytics/event-types/page-home.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export const HOME_PAGE_VIEWED = 'Home Page Viewed';
44
export const HOME_PAGE_JOIN_SPECTRUM_CLICKED = 'Home Page Join Spectrum Clicked';
55
export const HOME_PAGE_CREATE_COMMUNITY_CLICKED = 'Home Page Create Community Clicked';
66
export const HOME_PAGE_SIGN_IN_CLICKED = 'Home Page Sign In Clicked';
7+
export const HOME_PAGE_LOG_IN_CLICKED = 'Home Page Log In Clicked';
78
export const HOME_PAGE_EXPLORE_CLICKED = 'Home Page Explore Clicked';
89
export const HOME_PAGE_EXAMPLE_CONVERSATION_CLICKED = 'Home Page Example Conversation Clicked';

shared/db/queries/user.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ export const createOrFindUser = (user: Object, providerMethod: string): Promise<
224224
if (storedUser && storedUser.id) {
225225
return Promise.resolve(storedUser);
226226
}
227-
227+
228+
// restrict new signups to github auth only
229+
if (providerMethod !== 'githubProviderId') return Promise.resolve(null)
228230
// if no user exists, create a new one with the oauth profile data
229231
return storeUser(user);
230232
})
@@ -233,6 +235,8 @@ export const createOrFindUser = (user: Object, providerMethod: string): Promise<
233235
console.error(err);
234236
return null;
235237
}
238+
239+
if (providerMethod !== 'githubProviderId') return null
236240
return storeUser(user);
237241
});
238242
};

src/components/fullscreenView/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const FullscreenViewContainer = styled.div`
1818
justify-content: flex-start;
1919
flex-direction: column;
2020
z-index: ${zIndex.fullscreen};
21-
overflow-y: scroll;
21+
overflow-y: auto;
2222
-webkit-transform: translate3d(0, 0, 0);
2323
`;
2424

src/components/loginButtonSet/facebook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const FacebookSigninButton = (props: ButtonProps) => {
1111
<A onClick={() => onClickHandler && onClickHandler('facebook')} href={href}>
1212
<FacebookButton showAfter={showAfter} preferred={preferred}>
1313
<Icon glyph={'facebook'} />
14-
<Label>Sign in with Facebook</Label>
14+
<Label>Log in with Facebook</Label>
1515
</FacebookButton>
1616
</A>
1717
);

0 commit comments

Comments
 (0)