Commit 025b6f9b authored by Jordi Mallach's avatar Jordi Mallach 🔥 Committed by Jordi Mallach

Add Phabricator OAuth2 support.

Signed-off-by: Jordi Mallach's avatarJordi Mallach <jordi.mallach@collabora.com>
Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@collabora.com>
parent ed6f4c89
......@@ -259,6 +259,14 @@ export default class AdminConsole extends React.Component {
schema: AdminDefinition.settings.authentication.gitlab.schema,
}}
/>
<SCRoute
path={`${props.match.url}/phabricator`}
component={SchemaAdminSettings}
extraProps={{
...extraProps,
schema: AdminDefinition.settings.authentication.phabricator.schema,
}}
/>
<SCRoute
path={`${props.match.url}/oauth`}
component={SchemaAdminSettings}
......
......@@ -835,6 +835,106 @@ export default {
],
},
},
phabricator: {
schema: {
id: 'PhabricatorSettings',
name: t('admin.authentication.phabricator'),
name_default: 'Phabricator',
onConfigLoad: (config) => {
const newState = {};
newState['PhabricatorSettings.Url'] = config.PhabricatorSettings.UserApiEndpoint.replace('/api/v4/user', '');
return newState;
},
onConfigSave: (config) => {
const newConfig = {...config};
newConfig.PhabricatorSettings.UserApiEndpoint = config.PhabricatorSettings.Url.replace(/\/$/, '') + '/api/user.whoami';
return newConfig;
},
settings: [
{
type: Constants.SettingsTypes.TYPE_BOOL,
key: 'PhabricatorSettings.Enable',
label: t('admin.phabricator.enableTitle'),
label_default: 'Enable authentication with Phabricator: ',
help_text: t('admin.phabricator.enableDescription'),
help_text_default: 'When true, Mattermost allows team creation and account signup using Phabricator OAuth.\n \n1. Log in to your Phabricator account and go to Applications → OAuth Server → Create OAuth Server.\n2. Enter Redirect URIs "<your-mattermost-url>/login/phabricator/complete" (example: http://localhost:8065/login/phabricator/complete) and "<your-mattermost-url>/signup/phabricator/complete".\n3. Then use "Show Application Secret" and "Client PHID" fields from Phabricator to complete the options below.\n4. Complete the Endpoint URLs below.',
help_text_markdown: true,
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.Id',
label: t('admin.phabricator.clientIdTitle'),
label_default: 'Application ID:',
help_text: t('admin.phabricator.clientIdDescription'),
help_text_default: 'Obtain this value via the instructions above for logging into Phabricator.',
placeholder: t('admin.phabricator.clientIdExample'),
placeholder_default: 'E.g.: "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"',
isDisabled: needsUtils.stateValueFalse('PhabricatorSettings.Enable'),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.Secret',
label: t('admin.phabricator.clientSecretTitle'),
label_default: 'Application Secret Key:',
help_text: t('admin.phabricator.clientSecretDescription'),
help_text_default: 'Obtain this value via the instructions above for logging into Phabricator.',
placeholder: t('admin.phabricator.clientSecretExample'),
placeholder_default: 'E.g.: "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"',
isDisabled: needsUtils.stateValueFalse('PhabricatorSettings.Enable'),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.Url',
label: t('admin.phabricator.siteUrl'),
label_default: 'Phabricator Site URL:',
help_text: t('admin.phabricator.siteUrlDescription'),
help_text_default: 'Enter the URL of your Phabricator instance, e.g. https://phabricator.example.com/. If your Phabricator instance is not set up with SSL, start the URL with http:// instead of https://.',
placeholder: t('admin.phabricator.siteUrlExample'),
placeholder_default: 'E.g.: https://',
isDisabled: needsUtils.stateValueFalse('PhabricatorSettings.Enable'),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.UserApiEndpoint',
label: t('admin.phabricator.userTitle'),
label_default: 'User API Endpoint:',
dynamic_value: (value, config, state) => {
if (state['PhabricatorSettings.Url']) {
return state['PhabricatorSettings.Url'].replace(/\/$/, '') + '/api/user.whoami';
}
return '';
},
isDisabled: () => true,
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.AuthEndpoint',
label: t('admin.phabricator.authTitle'),
label_default: 'Auth Endpoint:',
dynamic_value: (value, config, state) => {
if (state['PhabricatorSettings.Url']) {
return state['PhabricatorSettings.Url'].replace(/\/$/, '') + '/oauthserver/auth/';
}
return '';
},
isDisabled: () => true,
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'PhabricatorSettings.TokenEndpoint',
label: t('admin.phabricator.tokenTitle'),
label_default: 'Token Endpoint:',
dynamic_value: (value, config, state) => {
if (state['PhabricatorSettings.Url']) {
return state['PhabricatorSettings.Url'].replace(/\/$/, '') + '/oauthserver/token/';
}
return '';
},
isDisabled: () => true,
},
],
},
},
oauth: {
schema: {
id: 'OAuthSettings',
......@@ -1107,7 +1207,7 @@ export default {
label: t('admin.email.allowSignupTitle'),
label_default: 'Enable account creation with email:',
help_text: t('admin.email.allowSignupDescription'),
help_text_default: 'When true, Mattermost allows account creation using email and password. This value should be false only when you want to limit sign up to a single sign-on service like AD/LDAP, SAML or GitLab.',
help_text_default: 'When true, Mattermost allows account creation using email and password. This value should be false only when you want to limit sign up to a single sign-on service like AD/LDAP, SAML, GitLab or Phabricator.',
},
{
type: Constants.SettingsTypes.TYPE_BOOL,
......@@ -1911,7 +2011,7 @@ export default {
label: t('admin.service.ssoSessionDays'),
label_default: 'Session Length SSO (days):',
help_text: t('admin.service.ssoSessionDaysDesc'),
help_text_default: 'The number of days from the last time a user entered their credentials to the expiry of the users session. If the authentication method is SAML or GitLab, the user may automatically be logged back in to Mattermost if they are already logged in to SAML or GitLab. After changing this setting, the setting will take effect after the next time the user enters their credentials.',
help_text_default: 'The number of days from the last time a user entered their credentials to the expiry of the users session. If the authentication method is SAML, GitLab or Phabricator, the user may automatically be logged back in to Mattermost if they are already logged in to SAML, GitLab or Phabricator. After changing this setting, the setting will take effect after the next time the user enters their credentials.',
placeholder: t('admin.service.sessionDaysEx'),
placeholder_default: 'E.g.: "30"',
},
......
......@@ -72,6 +72,8 @@ export default class AdminSidebar extends React.Component {
let oauthSettings = null;
let ldapSettings = null;
let samlSettings = null;
let gitlabSettings = null;
let phabricatorSettings = null;
let clusterSettings = null;
let metricsSettings = null;
let complianceSettings = null;
......@@ -234,7 +236,7 @@ export default class AdminSidebar extends React.Component {
/>
);
} else {
oauthSettings = (
gitlabSettings = (
<AdminSidebarSection
name='gitlab'
title={
......@@ -245,6 +247,18 @@ export default class AdminSidebar extends React.Component {
}
/>
);
phabricatorSettings = (
<AdminSidebarSection
name='phabricator'
title={
<FormattedMessage
id='admin.sidebar.phabricator'
defaultMessage='Phabricator'
/>
}
/>
);
}
if (this.props.license.IsLicensed === 'true') {
......@@ -534,6 +548,8 @@ export default class AdminSidebar extends React.Component {
}
/>
{oauthSettings}
{gitlabSettings}
{phabricatorSettings}
{ldapSettings}
{samlSettings}
{mfaSettings}
......
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {FormattedHTMLMessage, FormattedMessage} from 'react-intl';
import * as Utils from 'utils/utils.jsx';
import AdminSettings from './admin_settings.jsx';
import BooleanSetting from './boolean_setting.jsx';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
export default class PhabricatorSettings extends AdminSettings {
constructor(props) {
super(props);
this.getConfigFromState = this.getConfigFromState.bind(this);
this.renderSettings = this.renderSettings.bind(this);
this.updatePhabricatorUrl = this.updatePhabricatorUrl.bind(this);
}
getConfigFromState(config) {
config.PhabricatorSettings.Enable = this.state.enable;
config.PhabricatorSettings.Id = this.state.id;
config.PhabricatorSettings.Secret = this.state.secret;
config.PhabricatorSettings.UserApiEndpoint = this.state.userApiEndpoint;
config.PhabricatorSettings.AuthEndpoint = this.state.authEndpoint;
config.PhabricatorSettings.TokenEndpoint = this.state.tokenEndpoint;
return config;
}
getStateFromConfig(config) {
return {
enable: config.PhabricatorSettings.Enable,
id: config.PhabricatorSettings.Id,
secret: config.PhabricatorSettings.Secret,
phabricatorUrl: config.PhabricatorSettings.UserApiEndpoint.replace('/api/user.whoami', ''),
userApiEndpoint: config.PhabricatorSettings.UserApiEndpoint,
authEndpoint: config.PhabricatorSettings.AuthEndpoint,
tokenEndpoint: config.PhabricatorSettings.TokenEndpoint,
};
}
updatePhabricatorUrl(id, value) {
let trimmedValue = value;
if (value.endsWith('/')) {
trimmedValue = value.slice(0, -1);
}
this.setState({
saveNeeded: true,
phabricatorUrl: value,
userApiEndpoint: trimmedValue + '/api/user.whoami',
authEndpoint: trimmedValue + '/oauthserver/auth/',
tokenEndpoint: trimmedValue + '/oauthserver/token/',
});
}
isPhabricatorURLSetByEnv = () => {
// Assume that if one of these has been set using an environment variable,
// all of them have been set that way
return this.isSetByEnv('PhabricatorSettings.AuthEndpoint') ||
this.isSetByEnv('PhabricatorSettings.TokenEndpoint') ||
this.isSetByEnv('PhabricatorSettings.UserApiEndpoint');
};
renderTitle() {
return (
<FormattedMessage
id='admin.authentication.phabricator'
defaultMessage='Phabricator'
/>
);
}
renderSettings() {
return (
<SettingsGroup>
<BooleanSetting
id='enable'
label={
<FormattedMessage
id='admin.phabricator.enableTitle'
defaultMessage='Enable authentication with Phabricator: '
/>
}
helpText={
<div>
<FormattedMessage
id='admin.phabricator.enableDescription'
defaultMessage='When true, Mattermost allows team creation and account signup using Phabricator OAuth.'
/>
<br/>
<FormattedHTMLMessage
id='admin.phabricator.EnableHtmlDesc'
defaultMessage='<ol><li>Log in to your Phabricator account and go to Applications -> OAuth Server -> Create OAuth Server.</li><li>Enter Redirect URIs "<your-mattermost-url>/login/phabricator/complete" (example: http://localhost:8065/login/phabricator/complete) and "<your-mattermost-url>/signup/phabricator/complete". </li><li>Then use "Show Application Secret" and "Client PHID" fields from Phabricator to complete the options below.</li><li>Complete the Endpoint URLs below. </li></ol>'
/>
</div>
}
value={this.state.enable}
onChange={this.handleChange}
setByEnv={this.isSetByEnv('PhabricatorSettings.Enable')}
/>
<TextSetting
id='id'
label={
<FormattedMessage
id='admin.phabricator.clientIdTitle'
defaultMessage='Application ID:'
/>
}
placeholder={Utils.localizeMessage('admin.phabricator.clientIdExample', 'E.g.: "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"')}
helpText={
<FormattedMessage
id='admin.phabricator.clientIdDescription'
defaultMessage='Obtain this value via the instructions above for logging into Phabricator'
/>
}
value={this.state.id}
onChange={this.handleChange}
disabled={!this.state.enable}
setByEnv={this.isSetByEnv('PhabricatorSettings.Id')}
/>
<TextSetting
id='secret'
label={
<FormattedMessage
id='admin.phabricator.clientSecretTitle'
defaultMessage='Application Secret Key:'
/>
}
placeholder={Utils.localizeMessage('admin.phabricator.clientSecretExample', 'E.g.: "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"')}
helpText={
<FormattedMessage
id='admin.phabricator.clientSecretDescription'
defaultMessage='Obtain this value via the instructions above for logging into Phabricator.'
/>
}
value={this.state.secret}
onChange={this.handleChange}
disabled={!this.state.enable}
setByEnv={this.isSetByEnv('PhabricatorSettings.Secret')}
/>
<TextSetting
id='phabricatorUrl'
label={
<FormattedMessage
id='admin.phabricator.siteUrl'
defaultMessage='Phabricator Site URL:'
/>
}
placeholder={Utils.localizeMessage('admin.phabricator.siteUrlExample', 'E.g.: https://')}
helpText={
<FormattedMessage
id='admin.phabricator.siteUrlDescription'
defaultMessage='Enter the URL of your Phabricator instance, e.g. https://example.com:3000. If your Phabricator instance is not set up with SSL, start the URL with http:// instead of https://.'
/>
}
value={this.state.phabricatorUrl}
onChange={this.updatePhabricatorUrl}
disabled={!this.state.enable}
setByEnv={this.isPhabricatorURLSetByEnv()}
/>
<TextSetting
id='userApiEndpoint'
label={
<FormattedMessage
id='admin.phabricator.userTitle'
defaultMessage='User API Endpoint:'
/>
}
placeholder={''}
value={this.state.userApiEndpoint}
disabled={true}
setByEnv={false}
/>
<TextSetting
id='authEndpoint'
label={
<FormattedMessage
id='admin.phabricator.authTitle'
defaultMessage='Auth Endpoint:'
/>
}
placeholder={''}
value={this.state.authEndpoint}
disabled={true}
setByEnv={false}
/>
<TextSetting
id='tokenEndpoint'
label={
<FormattedMessage
id='admin.phabricator.tokenTitle'
defaultMessage='Token Endpoint:'
/>
}
placeholder={''}
value={this.state.tokenEndpoint}
disabled={true}
setByEnv={false}
/>
</SettingsGroup>
);
}
}
......@@ -131,6 +131,21 @@ export default function ErrorMessage({type, message, service}) {
}}
/>
</p>
<p>
<FormattedMessage
id='error.oauth_missing_code.phabricator'
defaultMessage='For {link} please make sure you followed the setup instructions.'
values={{
link: (
<ErrorLink
url={'https://docs.mattermost.com/deployment/sso-phabricator.html'}
messageId={t('error.oauth_missing_code.phabricator.link')}
defaultMessage={'Phabricator'}
/>
),
}}
/>
</p>
<p>
<FormattedMessage
id='error.oauth_missing_code.forum'
......
......@@ -32,6 +32,7 @@ function mapStateToProps(state) {
const enableSignInWithUsername = config.EnableSignInWithUsername === 'true';
const enableSignUpWithEmail = config.EnableSignUpWithEmail === 'true';
const enableSignUpWithGitLab = config.EnableSignUpWithGitLab === 'true';
const enableSignUpWithPhabricator = config.EnableSignUpWithPhabricator === 'true';
const enableSignUpWithGoogle = config.EnableSignUpWithGoogle === 'true';
const enableSignUpWithOffice365 = config.EnableSignUpWithOffice365 === 'true';
const ldapLoginFieldName = config.LdapLoginFieldName;
......@@ -66,6 +67,7 @@ function mapStateToProps(state) {
enableSignInWithUsername,
enableSignUpWithEmail,
enableSignUpWithGitLab,
enableSignUpWithPhabricator,
enableSignUpWithGoogle,
enableSignUpWithOffice365,
experimentalPrimaryTeam,
......
......@@ -46,6 +46,7 @@ class LoginController extends React.Component {
enableSignInWithUsername: PropTypes.bool.isRequired,
enableSignUpWithEmail: PropTypes.bool.isRequired,
enableSignUpWithGitLab: PropTypes.bool.isRequired,
enableSignUpWithPhabricator: PropTypes.bool.isRequired,
enableSignUpWithGoogle: PropTypes.bool.isRequired,
enableSignUpWithOffice365: PropTypes.bool.isRequired,
experimentalPrimaryTeam: PropTypes.string,
......@@ -410,6 +411,7 @@ class LoginController extends React.Component {
checkSignUpEnabled = () => {
return this.props.enableSignUpWithEmail ||
this.props.enableSignUpWithGitLab ||
this.props.enableSignUpWithPhabricator ||
this.props.enableSignUpWithOffice365 ||
this.props.enableSignUpWithGoogle ||
this.props.enableLdap ||
......@@ -534,6 +536,7 @@ class LoginController extends React.Component {
const ldapEnabled = this.state.ldapEnabled;
const gitlabSigninEnabled = this.props.enableSignUpWithGitLab;
const phabricatorSigninEnabled = this.props.enableSignUpWithPhabricator;
const googleSigninEnabled = this.props.enableSignUpWithGoogle;
const office365SigninEnabled = this.props.enableSignUpWithOffice365;
const samlSigninEnabled = this.state.samlEnabled;
......@@ -662,7 +665,7 @@ class LoginController extends React.Component {
);
}
if ((emailSigninEnabled || usernameSigninEnabled || ldapEnabled) && (gitlabSigninEnabled || googleSigninEnabled || samlSigninEnabled || office365SigninEnabled)) {
if ((emailSigninEnabled || usernameSigninEnabled || ldapEnabled) && (gitlabSigninEnabled || phabricatorSigninEnabled || googleSigninEnabled || samlSigninEnabled || office365SigninEnabled)) {
loginControls.push(
<div
key='divider'
......@@ -705,6 +708,26 @@ class LoginController extends React.Component {
);
}
if (phabricatorSigninEnabled) {
loginControls.push(
<a
className='btn btn-custom-login phabricator'
key='phabricator'
href={Client4.getOAuthRoute() + '/phabricator/login' + this.props.location.search}
>
<span>
<span className='icon'/>
<span>
<FormattedMessage
id='login.phabricator'
defaultMessage='Phabricator'
/>
</span>
</span>
</a>
);
}
if (googleSigninEnabled) {
loginControls.push(
<a
......
......@@ -23,6 +23,7 @@ function mapStateToProps(state, ownProps) {
const noAccounts = config.NoAccounts === 'true';
const enableSignUpWithEmail = config.EnableSignUpWithEmail === 'true';
const enableSignUpWithGitLab = config.EnableSignUpWithGitLab === 'true';
const enableSignUpWithPhabricator = config.EnableSignUpWithPhabricator === 'true';
const enableSignUpWithGoogle = config.EnableSignUpWithGoogle === 'true';
const enableSignUpWithOffice365 = config.EnableSignUpWithOffice365 === 'true';
const enableLDAP = config.EnableLdap === 'true';
......@@ -48,6 +49,7 @@ function mapStateToProps(state, ownProps) {
noAccounts,
enableSignUpWithEmail,
enableSignUpWithGitLab,
enableSignUpWithPhabricator,
enableSignUpWithGoogle,
enableSignUpWithOffice365,
enableLDAP,
......
......@@ -189,6 +189,26 @@ export default class SignupController extends React.Component {
);
}
if (this.props.enableSignUpWithPhabricator) {
signupControls.push(
<a
className='btn btn-custom-login btn--full phabricator'
key='phabricator'
href={Client4.getOAuthRoute() + '/phabricator/signup' + window.location.search}
>
<span>
<span className='icon'/>
<span>
<FormattedMessage
id='signup.phabricator'
defaultMessage='Phabricator Single Sign-On'
/>
</span>
</span>
</a>
);
}
if (this.props.isLicensed && this.props.enableSignUpWithGoogle) {
signupControls.push(
<a
......
......@@ -551,6 +551,24 @@ class UserSettingsGeneralTab extends React.Component {
{helpText}
</div>
);
} else if (this.props.user.auth_service === Constants.PHABRICATOR_SERVICE) {
inputs.push(
<div
key='oauthEmailInfo'
className='form-group'
>
<div className='setting-list__hint col-sm-12'>
<FormattedMessage
id='user.settings.general.emailPhabricatorCantUpdate'
defaultMessage='Login occurs through Phabricator. Email cannot be updated. Email address used for notifications is {email}.'
values={{
email: this.state.originalEmail,
}}
/>
</div>
{helpText}
</div>
);
} else if (this.props.user.auth_service === Constants.GOOGLE_SERVICE) {
inputs.push(
<div
......@@ -678,6 +696,16 @@ class UserSettingsGeneralTab extends React.Component {
}}
/>
);
} else if (this.props.user.auth_service === Constants.PHABRICATOR_SERVICE) {
describe = (
<FormattedMessage
id='user.settings.general.loginPhabricator'
defaultMessage='Login done through Phabricator ({email})'
values={{
email: this.state.originalEmail,
}}
/>
);
} else if (this.props.user.auth_service === Constants.GOOGLE_SERVICE) {
describe = (
<FormattedMessage
......
......@@ -22,6 +22,7 @@ function mapStateToProps(state, ownProps) {
const enableOAuthServiceProvider = config.EnableOAuthServiceProvider === 'true';
const enableSignUpWithEmail = config.EnableSignUpWithEmail === 'true';
const enableSignUpWithGitLab = config.EnableSignUpWithGitLab === 'true';
const enableSignUpWithPhabricator = config.EnableSignUpWithPhabricator === 'true';
const enableSignUpWithGoogle = config.EnableSignUpWithGoogle === 'true';
const enableLdap = config.EnableLdap === 'true';
const enableSaml = config.EnableSaml === 'true';
......@@ -33,6 +34,7 @@ function mapStateToProps(state, ownProps) {
enableOAuthServiceProvider,
enableSignUpWithEmail,
enableSignUpWithGitLab,
enableSignUpWithPhabricator,
enableSignUpWithGoogle,
enableLdap,
enableSaml,
......
......@@ -48,6 +48,9 @@ export default class SecurityTab extends React.Component {
// Whether or not sign-up with GitLab is enabled.
enableSignUpWithGitLab: PropTypes.bool,
// Whether or not sign-up with Phabricator is enabled.
enableSignUpWithPhabricator: PropTypes.bool,
// Whether or not sign-up with Google is enabled.
enableSignUpWithGoogle: PropTypes.bool,
......@@ -301,6 +304,20 @@ export default class SecurityTab extends React.Component {
</div>
</div>
);
} else if (this.props.user.auth_service === Constants.PHABRICATOR_SERVICE) {
inputs.push(
<div
key='oauthEmailInfo'
className='form-group'
>
<div className='setting-list__hint col-sm-12'>
<FormattedMessage
id='user.settings.security.passwordPhabricatorCantUpdate'
defaultMessage='Login occurs through Phabricator. Password cannot be updated.'
/>
</div>
</div>
);
} else if (this.props.user.auth_service === Constants.LDAP_SERVICE) {
inputs.push(
<div
......@@ -413,6 +430,13 @@ export default class SecurityTab extends React.Component {
defaultMessage='Login done through GitLab'
/>
);
} else if (this.props.user.auth_service === Constants.PHABRICATOR_SERVICE) {
describe = (
<FormattedMessage
id='user.settings.security.loginPhabricator'
defaultMessage='Login done through Phabricator'
/>
);
} else if (this.props.user.auth_service === Constants.LDAP_SERVICE) {
describe = (
<FormattedMessage
......@@ -464,6 +488,7 @@ export default class SecurityTab extends React.Component {
if (this.props.activeSection === SECTION_SIGNIN) {
let emailOption;
let gitlabOption;
let phabricatorOption;
let googleOption;
let office365Option;
let ldapOption;
......@@ -487,6 +512,23 @@ export default class SecurityTab extends React.Component {
);
}
if (this.props.enableSignUpWithPhabricator) {
phabricatorOption = (
<div className='padding-bottom x2'>
<Link
className='btn btn-primary'
to={'/claim/email_to_oauth?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.PHABRICATOR_SERVICE}
>
<FormattedMessage
id='user.settings.security.switchPhabricator'
defaultMessage='Switch to using Phabricator SSO'
/>
</Link>
<br/>
</div>
);
}
if (this.props.enableSignUpWithGoogle) {
googleOption = (
<div className='padding-bottom x2'>
......@@ -583,6 +625,7 @@ export default class SecurityTab extends React.Component {
<div key='userSignInOption'>
{emailOption}
{gitlabOption}
{phabricatorOption}
{googleOption}
{office365Option}
{ldapOption}
......@@ -623,6 +666,13 @@ export default class SecurityTab extends React.Component {
defaultMessage='GitLab'
/>
);
} else if (this.props.user.auth_service === Constants.PHABRICATOR_SERVICE) {
describe = (
<FormattedMessage
id='user.settings.security.phabricator'
defaultMessage='Phabricator'
/>
);
} else if (this.props.user.auth_service === Constants.GOOGLE_SERVICE) {
describe = (
<FormattedMessage
......@@ -801,6 +851,7 @@ export default class SecurityTab extends React.Component {
let numMethods = 0;
numMethods = this.props.enableSignUpWithGitLab ? numMethods + 1 : numMethods;
numMethods = this.props.enableSignUpWithPhabricator ? numMethods + 1 : numMethods;
numMethods = this.props.enableSignUpWithGoogle ? numMethods + 1 : numMethods;
numMethods = this.props.enableSignUpWithOffice365 ? numMethods + 1 : numMethods;