-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLogin.js
More file actions
68 lines (59 loc) · 1.84 KB
/
Login.js
File metadata and controls
68 lines (59 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {changePageTitle} from '../Layout/Actions/LayoutActions';
class Login extends Component {
constructor() {
super();
this.login = this.login.bind(this)
}
componentWillMount() {
const {title} = Login.getPageMeta();
this.props.changePageTitle(title);
}
componentDidMount() {
if (this.props.loggedIn) {
window.location.href = '/membershipPortal'
}
}
static getPageMeta() {
return {
title: `Login | Data Skeptic`
}
}
login() {
window.location.href = '/api/v1/auth/login/google/'
}
render() {
const { loggedIn, user } = this.props
return (
<div className="center">
<div className="admin-auth-container">
{!loggedIn
? (
<div>
<h3>Membership login</h3>
<p>For people with active Data Skeptic memberships, please log in via the botton below to manage your account and access exclusive features.</p>
<button className="btn btn-primary" onClick={this.login}>Log in</button>
</div>
)
: (
<div>
<h3>Login Success</h3>
</div>
)
}
</div>
</div>
)
}
}
export default connect(
(state) => ({
user: state.auth.getIn(['user']).toJS(),
loggedIn: state.auth.getIn(['loggedIn'])
}),
(dispatch) => bindActionCreators({
changePageTitle
}, dispatch)
)(Login);