2015-10-08 12:27:09 -04:00
|
|
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
2015-06-14 23:53:32 -08:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
2015-12-08 13:38:43 -05:00
|
|
|
import LoginEmail from './login_email.jsx';
|
|
|
|
|
import LoginLdap from './login_ldap.jsx';
|
2015-06-14 23:53:32 -08:00
|
|
|
|
2015-12-17 12:44:46 -05:00
|
|
|
import * as Utils from '../utils/utils.jsx';
|
|
|
|
|
import Constants from '../utils/constants.jsx';
|
|
|
|
|
|
2016-01-21 14:15:44 -06:00
|
|
|
var FormattedMessage = ReactIntl.FormattedMessage;
|
|
|
|
|
|
2015-08-19 12:22:37 -07:00
|
|
|
export default class Login extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
2015-08-28 08:37:55 -04:00
|
|
|
|
2015-08-19 12:22:37 -07:00
|
|
|
this.state = {};
|
|
|
|
|
}
|
|
|
|
|
render() {
|
2015-08-31 11:31:55 -04:00
|
|
|
const teamDisplayName = this.props.teamDisplayName;
|
|
|
|
|
const teamName = this.props.teamName;
|
2015-06-14 23:53:32 -08:00
|
|
|
|
2015-08-31 11:31:55 -04:00
|
|
|
let loginMessage = [];
|
2015-10-16 09:10:54 -07:00
|
|
|
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
2015-08-14 12:35:43 -04:00
|
|
|
loginMessage.push(
|
2015-08-28 08:37:55 -04:00
|
|
|
<a
|
|
|
|
|
className='btn btn-custom-login gitlab'
|
|
|
|
|
href={'/' + teamName + '/login/gitlab'}
|
|
|
|
|
>
|
|
|
|
|
<span className='icon' />
|
2015-10-27 22:18:52 -07:00
|
|
|
<span>{'with GitLab'}</span>
|
2015-08-28 08:37:55 -04:00
|
|
|
</a>
|
|
|
|
|
);
|
2015-07-22 15:32:39 -04:00
|
|
|
}
|
2015-08-28 08:37:55 -04:00
|
|
|
|
2015-12-08 13:38:43 -05:00
|
|
|
if (global.window.mm_config.EnableSignUpWithGoogle === 'true') {
|
|
|
|
|
loginMessage.push(
|
|
|
|
|
<a
|
|
|
|
|
className='btn btn-custom-login google'
|
|
|
|
|
href={'/' + teamName + '/login/google'}
|
|
|
|
|
>
|
|
|
|
|
<span className='icon' />
|
|
|
|
|
<span>{'with Google Apps'}</span>
|
|
|
|
|
</a>
|
|
|
|
|
);
|
2015-08-14 12:35:43 -04:00
|
|
|
}
|
2015-07-22 15:32:39 -04:00
|
|
|
|
2015-12-17 12:44:46 -05:00
|
|
|
const extraParam = Utils.getUrlParameter('extra');
|
|
|
|
|
let extraBox = '';
|
|
|
|
|
if (extraParam) {
|
|
|
|
|
let msg;
|
|
|
|
|
if (extraParam === Constants.SIGNIN_CHANGE) {
|
|
|
|
|
msg = ' Sign-in method changed successfully';
|
|
|
|
|
} else if (extraParam === Constants.SIGNIN_VERIFIED) {
|
|
|
|
|
msg = ' Email Verified';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
extraBox = (
|
|
|
|
|
<div className='alert alert-success'>
|
|
|
|
|
<i className='fa fa-check' />
|
|
|
|
|
{msg}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-10-06 09:12:49 -04:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 11:31:55 -04:00
|
|
|
let emailSignup;
|
2015-10-16 09:10:54 -07:00
|
|
|
if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
2015-08-28 08:37:55 -04:00
|
|
|
emailSignup = (
|
2015-12-08 13:38:43 -05:00
|
|
|
<LoginEmail
|
|
|
|
|
teamName={this.props.teamName}
|
|
|
|
|
/>
|
2015-08-28 08:37:55 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (loginMessage.length > 0 && emailSignup) {
|
|
|
|
|
loginMessage = (
|
|
|
|
|
<div>
|
|
|
|
|
{loginMessage}
|
|
|
|
|
<div className='or__container'>
|
2015-10-27 22:18:52 -07:00
|
|
|
<span>{'or'}</span>
|
2015-08-28 08:37:55 -04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2015-08-31 14:06:14 -04:00
|
|
|
}
|
2015-08-28 08:37:55 -04:00
|
|
|
|
2015-08-31 11:31:55 -04:00
|
|
|
let forgotPassword;
|
2015-08-31 14:06:14 -04:00
|
|
|
if (emailSignup) {
|
2015-08-28 08:37:55 -04:00
|
|
|
forgotPassword = (
|
|
|
|
|
<div className='form-group'>
|
2016-01-21 14:15:44 -06:00
|
|
|
<a href={'/' + teamName + '/reset_password'}>
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id='login.forgot_password'
|
|
|
|
|
defaultMessage='I forgot my password'
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
2015-10-27 22:18:52 -07:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let userSignUp = null;
|
|
|
|
|
if (this.props.inviteId) {
|
|
|
|
|
userSignUp = (
|
|
|
|
|
<div>
|
2015-11-02 12:34:18 -08:00
|
|
|
<span>{`Don't have an account? `}
|
2015-10-27 22:18:52 -07:00
|
|
|
<a
|
|
|
|
|
href={'/signup_user_complete/?id=' + this.props.inviteId}
|
|
|
|
|
className='signup-team-login'
|
|
|
|
|
>
|
|
|
|
|
{'Create one now'}
|
|
|
|
|
</a>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let teamSignUp = null;
|
2016-01-26 19:53:33 -05:00
|
|
|
if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) {
|
2015-10-27 22:18:52 -07:00
|
|
|
teamSignUp = (
|
|
|
|
|
<div className='margin--extra'>
|
2015-11-17 17:09:55 -06:00
|
|
|
<a
|
|
|
|
|
href='/'
|
|
|
|
|
className='signup-team-login'
|
|
|
|
|
>
|
|
|
|
|
{'Create a new team'}
|
|
|
|
|
</a>
|
2015-08-28 08:37:55 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-08 13:38:43 -05:00
|
|
|
let ldapLogin = null;
|
|
|
|
|
if (global.window.mm_config.EnableLdap === 'true') {
|
|
|
|
|
ldapLogin = (
|
|
|
|
|
<LoginLdap
|
|
|
|
|
teamName={this.props.teamName}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-26 20:32:24 -05:00
|
|
|
let findTeams = null;
|
|
|
|
|
if (!Utils.isMobileApp()) {
|
|
|
|
|
findTeams = (
|
|
|
|
|
<div className='form-group margin--extra form-group--small'>
|
|
|
|
|
<span>
|
|
|
|
|
<a href='/find_team'>
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id='login.find_teams'
|
|
|
|
|
defaultMessage='Find your other teams'
|
|
|
|
|
/>
|
|
|
|
|
</a></span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 08:37:55 -04:00
|
|
|
return (
|
|
|
|
|
<div className='signup-team__container'>
|
2015-10-27 22:18:52 -07:00
|
|
|
<h5 className='margin--less'>{'Sign in to:'}</h5>
|
2015-08-28 08:37:55 -04:00
|
|
|
<h2 className='signup-team__name'>{teamDisplayName}</h2>
|
2015-10-27 22:18:52 -07:00
|
|
|
<h2 className='signup-team__subdomain'>{'on '}{global.window.mm_config.SiteName}</h2>
|
2015-12-17 12:44:46 -05:00
|
|
|
{extraBox}
|
2015-08-14 12:35:43 -04:00
|
|
|
{loginMessage}
|
2015-08-28 08:37:55 -04:00
|
|
|
{emailSignup}
|
2015-12-08 13:38:43 -05:00
|
|
|
{ldapLogin}
|
2015-10-27 22:18:52 -07:00
|
|
|
{userSignUp}
|
2016-01-26 20:32:24 -05:00
|
|
|
{findTeams}
|
2015-08-28 08:37:55 -04:00
|
|
|
{forgotPassword}
|
2015-10-27 22:18:52 -07:00
|
|
|
{teamSignUp}
|
2015-06-14 23:53:32 -08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-08-19 12:22:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Login.defaultProps = {
|
|
|
|
|
teamName: '',
|
2015-09-21 17:52:30 -07:00
|
|
|
teamDisplayName: ''
|
2015-08-19 12:22:37 -07:00
|
|
|
};
|
|
|
|
|
Login.propTypes = {
|
|
|
|
|
teamName: React.PropTypes.string,
|
2015-10-27 22:18:52 -07:00
|
|
|
teamDisplayName: React.PropTypes.string,
|
|
|
|
|
inviteId: React.PropTypes.string
|
2015-08-19 12:22:37 -07:00
|
|
|
};
|