Merge branch 'release-3.3' RC4
Этот коммит содержится в:
@@ -33,11 +33,9 @@ func InitOAuth() {
|
|||||||
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
|
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
|
||||||
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/login", AppHandlerIndependent(loginWithOAuth)).Methods("GET")
|
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/login", AppHandlerIndependent(loginWithOAuth)).Methods("GET")
|
||||||
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/signup", AppHandlerIndependent(signupWithOAuth)).Methods("GET")
|
BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/signup", AppHandlerIndependent(signupWithOAuth)).Methods("GET")
|
||||||
BaseRoutes.OAuth.Handle("/authorize", AppHandlerTrustRequester(authorizeOAuth)).Methods("GET")
|
|
||||||
BaseRoutes.OAuth.Handle("/access_token", ApiAppHandlerTrustRequester(getAccessToken)).Methods("POST")
|
|
||||||
|
|
||||||
BaseRoutes.Root.Handle("/authorize", AppHandlerTrustRequester(authorizeOAuth)).Methods("GET")
|
BaseRoutes.Root.Handle("/oauth/authorize", AppHandlerTrustRequester(authorizeOAuth)).Methods("GET")
|
||||||
BaseRoutes.Root.Handle("/access_token", ApiAppHandlerTrustRequester(getAccessToken)).Methods("POST")
|
BaseRoutes.Root.Handle("/oauth/access_token", ApiAppHandlerTrustRequester(getAccessToken)).Methods("POST")
|
||||||
|
|
||||||
// Handle all the old routes, to be later removed
|
// Handle all the old routes, to be later removed
|
||||||
BaseRoutes.Root.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
|
BaseRoutes.Root.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
|
||||||
|
|||||||
@@ -1533,7 +1533,7 @@ func (c *Client) DeleteOAuthApp(id string) (*Result, *AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
|
func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
|
||||||
if r, err := c.DoPost(API_URL_SUFFIX+"/oauth/access_token", data.Encode(), "application/x-www-form-urlencoded"); err != nil {
|
if r, err := c.DoPost("/oauth/access_token", data.Encode(), "application/x-www-form-urlencoded"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
defer closeBody(r)
|
defer closeBody(r)
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ export default class OAuthSettings extends AdminSettings {
|
|||||||
oauthTypes.push({value: Constants.GOOGLE_SERVICE, text: Utils.localizeMessage('admin.oauth.google', 'Google Apps')});
|
oauthTypes.push({value: Constants.GOOGLE_SERVICE, text: Utils.localizeMessage('admin.oauth.google', 'Google Apps')});
|
||||||
}
|
}
|
||||||
if (global.window.mm_license.Office365SSO === 'true') {
|
if (global.window.mm_license.Office365SSO === 'true') {
|
||||||
oauthTypes.push({value: Constants.OFFICE365_SERVICE, text: Utils.localizeMessage('admin.oauth.office365', 'Office 365')});
|
oauthTypes.push({value: Constants.OFFICE365_SERVICE, text: Utils.localizeMessage('admin.oauth.office365', 'Office 365 (Beta)')});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,28 +34,31 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update sample message from config settings
|
// Update sample message from config settings
|
||||||
let sampleErrorMsgId = 'user.settings.security.passwordError';
|
this.sampleErrorMsg = null;
|
||||||
if (props.config.PasswordSettings.Lowercase) {
|
if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.PasswordRequirements === 'true') {
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
|
let sampleErrorMsgId = 'user.settings.security.passwordError';
|
||||||
|
if (props.config.PasswordSettings.Lowercase) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
|
||||||
|
}
|
||||||
|
if (props.config.PasswordSettings.Uppercase) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
|
||||||
|
}
|
||||||
|
if (props.config.PasswordSettings.Number) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Number';
|
||||||
|
}
|
||||||
|
if (props.config.PasswordSettings.Symbol) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
|
||||||
|
}
|
||||||
|
this.sampleErrorMsg = (
|
||||||
|
<FormattedMessage
|
||||||
|
id={sampleErrorMsgId}
|
||||||
|
default='Your password must be at least {min} characters.'
|
||||||
|
values={{
|
||||||
|
min: props.config.PasswordSettings.MinimumLength
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (props.config.PasswordSettings.Uppercase) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
|
|
||||||
}
|
|
||||||
if (props.config.PasswordSettings.Number) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Number';
|
|
||||||
}
|
|
||||||
if (props.config.PasswordSettings.Symbol) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
|
|
||||||
}
|
|
||||||
this.sampleErrorMsg = (
|
|
||||||
<FormattedMessage
|
|
||||||
id={sampleErrorMsgId}
|
|
||||||
default='Your password must be at least {min} characters.'
|
|
||||||
values={{
|
|
||||||
min: props.config.PasswordSettings.MinimumLength
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUpdate() {
|
componentWillUpdate() {
|
||||||
@@ -94,37 +97,41 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSampleErrorMsg() {
|
getSampleErrorMsg() {
|
||||||
if (this.props.config.PasswordSettings.MinimumLength > Constants.MAX_PASSWORD_LENGTH || this.props.config.PasswordSettings.MinimumLength < Constants.MIN_PASSWORD_LENGTH) {
|
if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.PasswordRequirements === 'true') {
|
||||||
|
if (this.props.config.PasswordSettings.MinimumLength > Constants.MAX_PASSWORD_LENGTH || this.props.config.PasswordSettings.MinimumLength < Constants.MIN_PASSWORD_LENGTH) {
|
||||||
|
return (
|
||||||
|
<FormattedMessage
|
||||||
|
id='user.settings.security.passwordMinLength'
|
||||||
|
default='Invalid minimum length, cannot show preview.'
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let sampleErrorMsgId = 'user.settings.security.passwordError';
|
||||||
|
if (this.refs.lowercase.checked) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
|
||||||
|
}
|
||||||
|
if (this.refs.uppercase.checked) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
|
||||||
|
}
|
||||||
|
if (this.refs.number.checked) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Number';
|
||||||
|
}
|
||||||
|
if (this.refs.symbol.checked) {
|
||||||
|
sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='user.settings.security.passwordMinLength'
|
id={sampleErrorMsgId}
|
||||||
default='Invalid minimum length, cannot show preview.'
|
default='Your password must be at least {min} characters.'
|
||||||
|
values={{
|
||||||
|
min: this.props.config.PasswordSettings.MinimumLength
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sampleErrorMsgId = 'user.settings.security.passwordError';
|
return null;
|
||||||
if (this.refs.lowercase.checked) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Lowercase';
|
|
||||||
}
|
|
||||||
if (this.refs.uppercase.checked) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Uppercase';
|
|
||||||
}
|
|
||||||
if (this.refs.number.checked) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Number';
|
|
||||||
}
|
|
||||||
if (this.refs.symbol.checked) {
|
|
||||||
sampleErrorMsgId = sampleErrorMsgId + 'Symbol';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<FormattedMessage
|
|
||||||
id={sampleErrorMsgId}
|
|
||||||
default='Your password must be at least {min} characters.'
|
|
||||||
values={{
|
|
||||||
min: this.props.config.PasswordSettings.MinimumLength
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTitle() {
|
renderTitle() {
|
||||||
|
|||||||
@@ -69,12 +69,12 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
if ((inviteId && inviteId.length > 0) || (hash && hash.length > 0)) {
|
if ((inviteId && inviteId.length > 0) || (hash && hash.length > 0)) {
|
||||||
// if we are already logged in then attempt to just join the team
|
// if we are already logged in then attempt to just join the team
|
||||||
if (UserStore.getCurrentUser()) {
|
if (UserStore.getCurrentUser()) {
|
||||||
loading = true;
|
|
||||||
Client.addUserToTeamFromInvite(
|
Client.addUserToTeamFromInvite(
|
||||||
data,
|
data,
|
||||||
hash,
|
hash,
|
||||||
inviteId,
|
inviteId,
|
||||||
(team) => {
|
(team) => {
|
||||||
|
loading = true;
|
||||||
GlobalActions.emitInitialLoad(
|
GlobalActions.emitInitialLoad(
|
||||||
() => {
|
() => {
|
||||||
browserHistory.push('/' + team.name);
|
browserHistory.push('/' + team.name);
|
||||||
@@ -111,14 +111,12 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
serverError: null,
|
serverError: null,
|
||||||
teamDisplayName: inviteData.display_name,
|
teamDisplayName: inviteData.display_name,
|
||||||
teamName: inviteData.name,
|
teamName: inviteData.name,
|
||||||
teamId: inviteData.id,
|
teamId: inviteData.id
|
||||||
loading: false
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
noOpenServerError: true,
|
noOpenServerError: true,
|
||||||
loading: false,
|
|
||||||
serverError:
|
serverError:
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='signup_user_completed.invalid_invite'
|
id='signup_user_completed.invalid_invite'
|
||||||
@@ -128,6 +126,7 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
loading = false;
|
||||||
data = '';
|
data = '';
|
||||||
hash = '';
|
hash = '';
|
||||||
}
|
}
|
||||||
@@ -145,8 +144,7 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='signup_user_completed.no_open_server'
|
id='signup_user_completed.no_open_server'
|
||||||
defaultMessage='This server does not allow open signups. Please speak with your Administrator to receive an invitation.'
|
defaultMessage='This server does not allow open signups. Please speak with your Administrator to receive an invitation.'
|
||||||
/>,
|
/>
|
||||||
loading: false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -477,7 +477,7 @@
|
|||||||
"admin.oauth.gitlab": "GitLab",
|
"admin.oauth.gitlab": "GitLab",
|
||||||
"admin.oauth.google": "Google Apps",
|
"admin.oauth.google": "Google Apps",
|
||||||
"admin.oauth.off": "Do not allow sign-in via an OAuth 2.0 provider",
|
"admin.oauth.off": "Do not allow sign-in via an OAuth 2.0 provider",
|
||||||
"admin.oauth.office365": "Office 365",
|
"admin.oauth.office365": "Office 365 (Beta)",
|
||||||
"admin.oauth.providerDescription": "When true, Mattermost can act as an OAuth 2.0 service provider allowing Mattermost to authorize API requests from external applications.",
|
"admin.oauth.providerDescription": "When true, Mattermost can act as an OAuth 2.0 service provider allowing Mattermost to authorize API requests from external applications.",
|
||||||
"admin.oauth.providerTitle": "Enable OAuth 2.0 Service Provider: ",
|
"admin.oauth.providerTitle": "Enable OAuth 2.0 Service Provider: ",
|
||||||
"admin.oauth.select": "Select OAuth 2.0 service provider:",
|
"admin.oauth.select": "Select OAuth 2.0 service provider:",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user