mirror of
https://github.com/flarum/framework.git
synced 2025-01-21 14:07:47 +08:00
Don't show username/email fields when editing own account. fixes #903
This commit is contained in:
parent
6a0ea61c55
commit
1fd5f3f545
26
framework/core/js/forum/dist/app.js
vendored
26
framework/core/js/forum/dist/app.js
vendored
|
@ -21756,10 +21756,9 @@ System.register('flarum/components/EditUserModal', ['flarum/components/Modal', '
|
|||
'Username'
|
||||
),
|
||||
m('input', { className: 'FormControl', placeholder: extractText(app.translator.trans('core.forum.edit_user.username_label')),
|
||||
value: this.username(),
|
||||
onchange: m.withAttr('value', this.username) })
|
||||
bidi: this.username })
|
||||
),
|
||||
m(
|
||||
app.session.user !== this.props.user ? [m(
|
||||
'div',
|
||||
{ className: 'Form-group' },
|
||||
m(
|
||||
|
@ -21771,11 +21770,9 @@ System.register('flarum/components/EditUserModal', ['flarum/components/Modal', '
|
|||
'div',
|
||||
null,
|
||||
m('input', { className: 'FormControl', placeholder: extractText(app.translator.trans('core.forum.edit_user.email_label')),
|
||||
value: this.email(),
|
||||
onchange: m.withAttr('value', this.email) })
|
||||
bidi: this.email })
|
||||
)
|
||||
),
|
||||
m(
|
||||
), m(
|
||||
'div',
|
||||
{ className: 'Form-group' },
|
||||
m(
|
||||
|
@ -21798,10 +21795,9 @@ System.register('flarum/components/EditUserModal', ['flarum/components/Modal', '
|
|||
'Set new password'
|
||||
),
|
||||
this.setPassword() ? m('input', { className: 'FormControl', type: 'password', name: 'password', placeholder: extractText(app.translator.trans('core.forum.edit_user.password_label')),
|
||||
value: this.password(),
|
||||
onchange: m.withAttr('value', this.password) }) : ''
|
||||
bidi: this.password }) : ''
|
||||
)
|
||||
),
|
||||
)] : '',
|
||||
m(
|
||||
'div',
|
||||
{ className: 'Form-group EditUserModal-groups' },
|
||||
|
@ -21820,9 +21816,8 @@ System.register('flarum/components/EditUserModal', ['flarum/components/Modal', '
|
|||
'label',
|
||||
{ className: 'checkbox' },
|
||||
m('input', { type: 'checkbox',
|
||||
checked: _this3.groups[group.id()](),
|
||||
disabled: _this3.props.user.id() === '1' && group.id() === Group.ADMINISTRATOR_ID,
|
||||
onchange: m.withAttr('checked', _this3.groups[group.id()]) }),
|
||||
bidi: _this3.groups[group.id()],
|
||||
disabled: _this3.props.user.id() === '1' && group.id() === Group.ADMINISTRATOR_ID }),
|
||||
GroupBadge.component({ group: group, label: '' }),
|
||||
' ',
|
||||
group.nameSingular()
|
||||
|
@ -21856,10 +21851,13 @@ System.register('flarum/components/EditUserModal', ['flarum/components/Modal', '
|
|||
|
||||
var data = {
|
||||
username: this.username(),
|
||||
email: this.email(),
|
||||
relationships: { groups: groups }
|
||||
};
|
||||
|
||||
if (app.session.user !== this.props.user) {
|
||||
data.email = this.email();
|
||||
}
|
||||
|
||||
if (this.setPassword()) {
|
||||
data.password = this.password();
|
||||
}
|
||||
|
|
|
@ -39,38 +39,37 @@ export default class EditUserModal extends Modal {
|
|||
<div className="Form-group">
|
||||
<label>Username</label>
|
||||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.username_label'))}
|
||||
value={this.username()}
|
||||
onchange={m.withAttr('value', this.username)} />
|
||||
bidi={this.username} />
|
||||
</div>
|
||||
|
||||
<div className="Form-group">
|
||||
<label>Email</label>
|
||||
<div>
|
||||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
|
||||
value={this.email()}
|
||||
onchange={m.withAttr('value', this.email)} />
|
||||
</div>
|
||||
</div>
|
||||
{app.session.user !== this.props.user ? [
|
||||
<div className="Form-group">
|
||||
<label>Email</label>
|
||||
<div>
|
||||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
|
||||
bidi={this.email} />
|
||||
</div>
|
||||
</div>,
|
||||
|
||||
<div className="Form-group">
|
||||
<label>Password</label>
|
||||
<div>
|
||||
<label className="checkbox">
|
||||
<input type="checkbox" checked={this.setPassword()} onchange={e => {
|
||||
this.setPassword(e.target.checked);
|
||||
m.redraw(true);
|
||||
if (e.target.checked) this.$('[name=password]').select();
|
||||
m.redraw.strategy('none');
|
||||
}}/>
|
||||
Set new password
|
||||
</label>
|
||||
{this.setPassword() ? (
|
||||
<input className="FormControl" type="password" name="password" placeholder={extractText(app.translator.trans('core.forum.edit_user.password_label'))}
|
||||
value={this.password()}
|
||||
onchange={m.withAttr('value', this.password)} />
|
||||
) : ''}
|
||||
<div className="Form-group">
|
||||
<label>Password</label>
|
||||
<div>
|
||||
<label className="checkbox">
|
||||
<input type="checkbox" checked={this.setPassword()} onchange={e => {
|
||||
this.setPassword(e.target.checked);
|
||||
m.redraw(true);
|
||||
if (e.target.checked) this.$('[name=password]').select();
|
||||
m.redraw.strategy('none');
|
||||
}}/>
|
||||
Set new password
|
||||
</label>
|
||||
{this.setPassword() ? (
|
||||
<input className="FormControl" type="password" name="password" placeholder={extractText(app.translator.trans('core.forum.edit_user.password_label'))}
|
||||
bidi={this.password} />
|
||||
) : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
] : ''}
|
||||
|
||||
<div className="Form-group EditUserModal-groups">
|
||||
<label>Groups</label>
|
||||
|
@ -80,9 +79,8 @@ export default class EditUserModal extends Modal {
|
|||
.map(group => (
|
||||
<label className="checkbox">
|
||||
<input type="checkbox"
|
||||
checked={this.groups[group.id()]()}
|
||||
disabled={this.props.user.id() === '1' && group.id() === Group.ADMINISTRATOR_ID}
|
||||
onchange={m.withAttr('checked', this.groups[group.id()])}/>
|
||||
bidi={this.groups[group.id()]}
|
||||
disabled={this.props.user.id() === '1' && group.id() === Group.ADMINISTRATOR_ID} />
|
||||
{GroupBadge.component({group, label: ''})} {group.nameSingular()}
|
||||
</label>
|
||||
))}
|
||||
|
@ -109,10 +107,13 @@ export default class EditUserModal extends Modal {
|
|||
|
||||
const data = {
|
||||
username: this.username(),
|
||||
email: this.email(),
|
||||
relationships: {groups}
|
||||
};
|
||||
|
||||
if (app.session.user !== this.props.user) {
|
||||
data.email = this.email();
|
||||
}
|
||||
|
||||
if (this.setPassword()) {
|
||||
data.password = this.password();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user