Merge pull request #2647 from mattermost/signup-fix

Fix email signup when LDAP is present
Этот коммит содержится в:
Joram Wilander
2016-04-06 09:04:37 -04:00
родитель 1a1fd39cf8 90ddfe82ee
Коммит 0aed1f5c09

Просмотреть файл

@@ -25,6 +25,7 @@ class SignupUserComplete extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.inviteInfoRecieved = this.inviteInfoRecieved.bind(this); this.inviteInfoRecieved = this.inviteInfoRecieved.bind(this);
this.handleLdapSignup = this.handleLdapSignup.bind(this);
this.state = { this.state = {
data: '', data: '',
@@ -81,6 +82,23 @@ class SignupUserComplete extends React.Component {
teamId: data.id teamId: data.id
}); });
} }
handleLdapSignup(method, loginId, password, token) {
Client.loginByLdap(this.state.teamName, loginId, password, token,
() => {
const redirect = Utils.getUrlParameter('redirect');
if (redirect) {
browserHistory.push(decodeURIComponent(redirect));
} else {
browserHistory.push('/' + this.state.teamName + '/channels/town-square');
}
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleSubmit(e) { handleSubmit(e) {
e.preventDefault(); e.preventDefault();
@@ -368,7 +386,7 @@ class SignupUserComplete extends React.Component {
defaultMessage='With your LDAP credentials' defaultMessage='With your LDAP credentials'
/> />
</strong></h5> </strong></h5>
<LoginLdap teamName={this.state.teamName}/> <LoginLdap submit={this.handleLdapSignup}/>
</div> </div>
); );
} }
@@ -376,7 +394,7 @@ class SignupUserComplete extends React.Component {
let emailSignup; let emailSignup;
if (global.window.mm_config.EnableSignUpWithEmail === 'true') { if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
emailSignup = ( emailSignup = (
<div> <form>
<div className='inner__content'> <div className='inner__content'>
{email} {email}
{yourEmailIs} {yourEmailIs}
@@ -432,7 +450,7 @@ class SignupUserComplete extends React.Component {
</button> </button>
</p> </p>
</div> </div>
</div> </form>
); );
} }
@@ -485,8 +503,6 @@ class SignupUserComplete extends React.Component {
</div> </div>
<div className='col-sm-12'> <div className='col-sm-12'>
<div className='signup-team__container padding--less'> <div className='signup-team__container padding--less'>
<div>
<form>
<img <img
className='signup-team-logo' className='signup-team-logo'
src={logoImage} src={logoImage}
@@ -517,8 +533,6 @@ class SignupUserComplete extends React.Component {
{ldapSignup} {ldapSignup}
{emailSignup} {emailSignup}
{serverError} {serverError}
</form>
</div>
</div> </div>
</div> </div>
</div> </div>