-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
761 additions
and
939 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
{ | ||
"watchDirectory": "", | ||
"accessTokenLifetime": "30d", | ||
"allowRemoteAccess": false, | ||
"workspaces": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React, { PureComponent } from 'react'; | ||
import { CallbackComponent } from 'redux-oidc'; | ||
import { Redirect } from 'react-router-dom'; | ||
import auth from 'app/lib/auth'; | ||
import { connect } from 'react-redux'; | ||
import styles from './index.styl'; | ||
|
||
class Callback extends PureComponent { | ||
state = { error: null, success: false, ready: false }; | ||
|
||
handleSuccess(oidc) { | ||
this.setState({ success: true }); | ||
|
||
auth.signin(oidc).then((authorized) => { | ||
if (authorized) { | ||
this.setState({ ready: true }); | ||
} else { | ||
this.setState({ error: { message: 'Failed to authenticate.' } }); | ||
} | ||
}); | ||
} | ||
|
||
handleError(err) { | ||
this.setState({ error: err }); | ||
} | ||
|
||
renderInner() { | ||
if (this.state.error) { | ||
const msg = this.state.error.message ?? this.state.error; | ||
return <Redirect to={`/login?error=${msg}`} />; | ||
} | ||
|
||
if (this.state.success) { | ||
if (!this.state.ready) { | ||
return <div>Loading Profile...</div>; | ||
} | ||
return <Redirect to="/" />; | ||
} | ||
|
||
return ( | ||
<CallbackComponent | ||
userManager={auth.manager} | ||
successCallback={(s) => this.handleSuccess(s)} | ||
errorCallback={(e) => this.handleError(e)} | ||
> | ||
<div>Authenticating...</div> | ||
</CallbackComponent> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.login} style={{ padding: '20px' }}> | ||
{this.renderInner()} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect()(Callback); |
Oops, something went wrong.