mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: respect email_editable
site setting in user activation page. (#11835)
Previously, when both `enable_local_logins` and `email_editable` are disabled still user can change the email in user activation page.
This commit is contained in:
parent
afe6db5f33
commit
c7781f1139
@ -1,4 +1,10 @@
|
||||
import Component from "@ember/component";
|
||||
import { or } from "@ember/object/computed";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: "activation-controls",
|
||||
canEditEmail: or(
|
||||
"siteSettings.enable_local_logins",
|
||||
"siteSettings.email_editable"
|
||||
),
|
||||
});
|
||||
|
@ -5,7 +5,9 @@
|
||||
class="btn-primary resend"}}
|
||||
{{/unless}}
|
||||
|
||||
{{d-button action=editActivationEmail
|
||||
label="login.change_email"
|
||||
icon="pencil-alt"
|
||||
class="edit-email"}}
|
||||
{{#if canEditEmail}}
|
||||
{{d-button action=editActivationEmail
|
||||
label="login.change_email"
|
||||
icon="pencil-alt"
|
||||
class="edit-email"}}
|
||||
{{/if}}
|
||||
|
@ -0,0 +1,25 @@
|
||||
import componentTest, {
|
||||
setupRenderingTest,
|
||||
} from "discourse/tests/helpers/component-test";
|
||||
import {
|
||||
discourseModule,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
discourseModule("Integration | Component | activation-controls", function (
|
||||
hooks
|
||||
) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
componentTest("hides change email button", {
|
||||
template: `{{activation-controls}}`,
|
||||
beforeEach() {
|
||||
this.siteSettings.enable_local_logins = false;
|
||||
this.siteSettings.email_editable = false;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(queryAll("button.edit-email").length, 0);
|
||||
},
|
||||
});
|
||||
});
|
@ -541,7 +541,9 @@ users:
|
||||
max: 10
|
||||
block_common_passwords: true
|
||||
username_change_period: 3
|
||||
email_editable: true
|
||||
email_editable:
|
||||
client: true
|
||||
default: true
|
||||
logout_redirect:
|
||||
client: true
|
||||
default: ""
|
||||
|
Loading…
Reference in New Issue
Block a user