Commit b2fcfada authored by Joram Wilander's avatar Joram Wilander Committed by Christopher Speller
Browse files

Allow system admins to switch user accounts to email/password (#2893)

parent 6a0858e4
......@@ -58,7 +58,8 @@ class ResetPasswordModal extends React.Component {
}
render() {
if (this.props.user == null) {
const user = this.props.user;
if (user == null) {
return <div/>;
}
......@@ -70,6 +71,23 @@ class ResetPasswordModal extends React.Component {
serverError = <div className='form-group has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
}
let title;
if (user.auth_service) {
title = (
<FormattedMessage
id='admin.reset_password.titleSwitch'
defaultMessage='Switch Account to Email/Password'
/>
);
} else {
title = (
<FormattedMessage
id='admin.reset_password.titleReset'
defaultMessage='Reset Password'
/>
);
}
return (
<Modal
show={this.props.show}
......@@ -77,10 +95,7 @@ class ResetPasswordModal extends React.Component {
>
<Modal.Header closeButton={true}>
<Modal.Title>
<FormattedMessage
id='admin.reset_password.title'
defaultMessage='Reset Password'
/>
{title}
</Modal.Title>
</Modal.Header>
<form
......
......@@ -366,6 +366,7 @@ export default class UserItem extends React.Component {
}
let authServiceText;
let passwordReset;
if (user.auth_service) {
authServiceText = (
<FormattedHTMLMessage
......@@ -376,6 +377,21 @@ export default class UserItem extends React.Component {
}}
/>
);
passwordReset = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleResetPassword}
>
<FormattedMessage
id='admin.user_item.switchToEmail'
defaultMessage='Switch to Email/Password'
/>
</a>
</li>
);
} else {
authServiceText = (
<FormattedHTMLMessage
......@@ -383,6 +399,25 @@ export default class UserItem extends React.Component {
defaultMessage=', <strong>Sign-in Method:</strong> Email'
/>
);
passwordReset = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleResetPassword}
>
<FormattedMessage
id='admin.user_item.resetPwd'
defaultMessage='Reset Password'
/>
</a>
</li>
);
}
if (global.window.mm_config.EnableSignInWithEmail !== 'true') {
passwordReset = null;
}
const me = UserStore.getCurrentUser();
......@@ -474,18 +509,7 @@ export default class UserItem extends React.Component {
{makeNotActive}
{makeSystemAdmin}
{mfaReset}
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleResetPassword}
>
<FormattedMessage
id='admin.user_item.resetPwd'
defaultMessage='Reset Password'
/>
</a>
</li>
{passwordReset}
</ul>
</div>
</div>
......
......@@ -378,7 +378,8 @@
"admin.reset_password.newPassword": "New Password",
"admin.reset_password.select": "Select",
"admin.reset_password.submit": "Please enter at least {chars} characters.",
"admin.reset_password.title": "Reset Password",
"admin.reset_password.titleReset": "Reset Password",
"admin.reset_password.titleSwitch": "Switch Account to Email/Password",
"admin.select_team.close": "Close",
"admin.select_team.select": "Select",
"admin.select_team.selectTeam": "Select Team",
......@@ -563,6 +564,7 @@
"admin.user_item.mfaYes": ", <strong>MFA</strong>: Yes",
"admin.user_item.resetMfa": "Remove MFA",
"admin.user_item.resetPwd": "Reset Password",
"admin.user_item.switchToEmail": "Switch to Email/Password",
"admin.user_item.sysAdmin": "System Admin",
"admin.user_item.teamAdmin": "Team Admin",
"analytics.chart.loading": "Loading...",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment