Closes #665 - Correctly handle user not granting auth permissions, display friendly error
This commit is contained in:
@@ -78,8 +78,13 @@ router.get('slack.callback', async ctx => {
|
||||
});
|
||||
|
||||
router.get('slack.commands', async ctx => {
|
||||
const { code } = ctx.request.query;
|
||||
ctx.assertPresent(code, 'code is required');
|
||||
const { code, error } = ctx.request.query;
|
||||
ctx.assertPresent(code || error, 'code is required');
|
||||
|
||||
if (error) {
|
||||
ctx.redirect(`/settings/integrations/slack?error=${error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const endpoint = `${process.env.URL || ''}/auth/slack.commands`;
|
||||
const data = await Slack.oauthAccess(code, endpoint);
|
||||
@@ -108,8 +113,13 @@ router.get('slack.commands', async ctx => {
|
||||
});
|
||||
|
||||
router.get('slack.post', async ctx => {
|
||||
const { code, state } = ctx.request.query;
|
||||
ctx.assertPresent(code, 'code is required');
|
||||
const { code, error, state } = ctx.request.query;
|
||||
ctx.assertPresent(code || error, 'code is required');
|
||||
|
||||
if (error) {
|
||||
ctx.redirect(`/settings/integrations/slack?error=${error}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const collectionId = state;
|
||||
ctx.assertUuid(collectionId, 'collectionId must be an uuid');
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Helmet } from 'react-helmet';
|
||||
import styled from 'styled-components';
|
||||
import Grid from 'styled-components-grid';
|
||||
import breakpoint from 'styled-components-breakpoint';
|
||||
import Notice from '../../shared/components/Notice';
|
||||
import Hero from './components/Hero';
|
||||
import SigninButtons from './components/SigninButtons';
|
||||
import { developers, githubUrl } from '../../shared/utils/routeHelpers';
|
||||
@@ -120,13 +121,6 @@ function Home(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
const Notice = styled.p`
|
||||
background: #ffd95c;
|
||||
color: hsla(46, 100%, 20%, 1);
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
`;
|
||||
|
||||
const Screenshot = styled.img`
|
||||
width: 100%;
|
||||
box-shadow: 0 0 80px 0 rgba(124, 124, 124, 0.5),
|
||||
|
||||
Reference in New Issue
Block a user