Skip to content

Commit

Permalink
Merge pull request rhinobird-io#215 from acearth/quick-login
Browse files Browse the repository at this point in the history
	Support Quick Login from Genius Center
  • Loading branch information
WangBoxue authored Jun 23, 2017
2 parents 04d0412 + 29525b2 commit 06d052d
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions app/components/Signin/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ var Login = React.createClass({
}
},
componentWillMount(){
this.props.setTitle("RhinoBird");
},
componentDidMount() {
this.refs.email.focus();
var query = this.context.router.getCurrentQuery();
if (query && query.ticket) {
$.post('/platform/api/genius_coming', {ticket: query.ticket, sign: query.sign}).then((data) => {
LoginAction.updateLogin(data);
this.context.router.transitionTo(this.context.router.getCurrentQuery().target || "/");
});
} else {
this.props.setTitle("RhinoBird");
}
},
_login(e){
e.preventDefault();
Expand All @@ -46,17 +51,27 @@ var Login = React.createClass({
});
});
},

_quick_login(){
window.location = 'http://genius.internal.worksap.com/login?app_id=rhinobird';
},
render() {
return <mui.Paper zDepth={1} className="loginForm" rounded={false}>
<form className="container" onSubmit={this._login}>
<h2 style={{marginBottom:24}}>Sign in</h2>
<h2 style={{marginBottom: 24}}>Sign in</h2>
<mui.TextField ref="email" hintText='Email' valueLink={this.linkState('email')} autofocus/>
<mui.TextField hintText='Password' type="password" valueLink={this.linkState('password')}
errorText={this.state.error? 'Email or password incorrect.' : undefined}/>
<div className="rightButton" style={{display:'flex', justifyContent:'space-between', alignItems:'center'}}>
<Common.Link href='/platform/signup'>Sign up now!</Common.Link>
<mui.RaisedButton label="Sign in" primary={true} onClick={this._login} type="submit"/>
errorText={this.state.error ? 'Email or password incorrect.' : undefined}/>
<div className="rightButton"
style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
<mui.RaisedButton label="Quick Login!" onClick={this._quick_login} primary={true} type="submit"/>
<mui.RaisedButton label="Sign in" onClick={this._login} type="submit"/>
</div>
<p>
<strong>Quick Login:</strong> Login ONCE for all applications from Genius Center.<br/>
<br/>
<Common.Link href="http://genius.internal.worksap.com/users/new">Register and try it
now!</Common.Link></p>
</form>
</mui.Paper>;
}
Expand Down

0 comments on commit 06d052d

Please sign in to comment.