diff --git a/frontend/index.js b/frontend/index.js index 0746ae45e..9dfd2d763 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -29,6 +29,7 @@ import SlackAuth from 'scenes/SlackAuth'; import Error404 from 'scenes/Error404'; window.stores = stores; +import ErrorAuth from 'scenes/ErrorAuth'; let DevTools; if (__DEV__) { @@ -78,6 +79,7 @@ render(( component={ SlackAuth } apiPath="/auth.slackCommands" /> + diff --git a/frontend/scenes/ErrorAuth/ErrorAuth.js b/frontend/scenes/ErrorAuth/ErrorAuth.js new file mode 100644 index 000000000..d0c25aefd --- /dev/null +++ b/frontend/scenes/ErrorAuth/ErrorAuth.js @@ -0,0 +1,23 @@ +import React from 'react'; +import { Link } from 'react-router'; + +import Layout from 'components/Layout'; +import CenteredContent from 'components/CenteredContent'; + +class ErrorAuth extends React.Component { + render() { + return ( + + + Authentication failed + + We were unable to log you in. Please try again. + + + ); + } +} + +export default ErrorAuth; diff --git a/frontend/scenes/ErrorAuth/index.js b/frontend/scenes/ErrorAuth/index.js new file mode 100644 index 000000000..fb4b27245 --- /dev/null +++ b/frontend/scenes/ErrorAuth/index.js @@ -0,0 +1,2 @@ +import ErrorAuth from './ErrorAuth'; +export default ErrorAuth; diff --git a/frontend/scenes/SlackAuth/SlackAuth.js b/frontend/scenes/SlackAuth/SlackAuth.js index 44a3eddbf..01dfe7ee3 100644 --- a/frontend/scenes/SlackAuth/SlackAuth.js +++ b/frontend/scenes/SlackAuth/SlackAuth.js @@ -12,7 +12,17 @@ class SlackAuth extends React.Component { } componentDidMount = async () => { - const { code, state } = this.props.location.query; + const { error, code, state } = this.props.location.query; + + if (error) { + if (error === 'access_denied') { + // User selected "Deny" access on Slack OAuth + browserHistory.push('/'); + } else { + browserHistory.push('/auth/error'); + } + return; + } if (this.props.route.apiPath) { try {
We were unable to log you in. Please try again.