Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerhutchings committed Feb 18, 2016
1 parent 72c0992 commit 6e3e8e2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
3 changes: 3 additions & 0 deletions src/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import Styles from './styles/main.styl';
import configureStore from './store';
const store = configureStore();

import { oauth } from 'panoptes-client';
oauth.init();

window.React = React;

ReactDOM.render(
Expand Down
3 changes: 2 additions & 1 deletion src/constants/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"authToken": "64aa60e488a555e2ef8b7f9d1621ec7e430dcb8b8baa0d00b8460eca5660d188",
"classrooms": "teachers/classrooms.json",
"root": "https://education.staging.zooniverse.org/"
}
},
"panoptesAppId": "24ad5676d5d25c6aa850dc5d5f63ec8c03dbc7ae113b6442b8571fce6c5b974c"
}
31 changes: 9 additions & 22 deletions src/containers/HeaderAuth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Panoptes from 'panoptes-client';

import LoginButton from '../presentational/LoginButton.jsx';
import LoggedInUser from '../presentational/LoggedInUser.jsx';

import { panoptesAppId } from '../constants/config.json';

export default class HeaderAuth extends Component {

Expand All @@ -19,35 +19,22 @@ export default class HeaderAuth extends Component {
}

componentDidMount() {
Panoptes.auth.checkCurrent()
.then(user => this.setState({user: user}));

}

login() {
console.log('Logging in');
// From the Rog Testing app on staging
const appId = '24ad5676d5d25c6aa850dc5d5f63ec8c03dbc7ae113b6442b8571fce6c5b974c';
const redirectUri = 'http://localhost:3000/?env=staging#/';
// From Wildcam on staging.
// For deploy-preview, comment the previous two line and use the following two
// const appId = '17bdbeb57f54a3bf6344cf7150047879cfa1c8d5f9fd77d64923e6c81fe6e949';
// const redirectUri = 'https://preview.zooniverse.org/wge/';
const url = [
Panoptes._config.host,
'/oauth/authorize',
'?response_type=token',
'&client_id=',
appId,
'&redirect_uri=',
redirectUri
].join('');
location.assign(url);
Panoptes.oauth.signIn({
appId: panoptesAppId,
redirectUri: 'http://localhost:3000/?env=staging#/',
});
// Panoptes.oauth.signOut();

This comment has been minimized.

Copy link
@simoneduca

simoneduca Feb 22, 2016

Contributor

Remove?


}

logout() {
console.log('Logging out');
Panoptes.auth.signOut()
.then(user => this.setState({user: user}));

}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/LoginHandler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class LoginHandler extends Component {
}

componentDidMount() {
this.completeLogin();
// this.completeLogin();

This comment has been minimized.

Copy link
@simoneduca

simoneduca Feb 22, 2016

Contributor

Remove?

}

render() {
Expand Down
11 changes: 11 additions & 0 deletions src/presentational/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import Panoptes from 'panoptes-client';

import Layout from './Layout.jsx'


export default class Home extends Component {

constructor() {
super();
this.iframe = this.iframe.bind(this);
}

iframe() {
Panoptes.oauth.checkCurrent();
}

render() {
return (
<Layout>
<div className="home-buttons container-fluid">
<h1>I am a...</h1>
<Link className='btn btn-info' role='button' to='/students'>Student</Link>
<Link className='btn btn-info' role='button' to='/teachers'>Teacher</Link>
<a className='btn btn-info' role='button' onClick={this.iframe}>iFrame</a>
</div>
</Layout>
);
Expand Down

0 comments on commit 6e3e8e2

Please sign in to comment.