mirror of
https://github.com/discourse/discourse.git
synced 2025-04-28 08:14:36 +08:00
FIX: Disallow email invites if enable_local_logins is disabled (#10805)
allowEmails used to always be set to true and did not use can_invite_via_email, which checks for enable_local_logins. It was a problem because on sites with local logins disabled users were allowed to enter email addresses, but received a generic error "error inviting that user".
This commit is contained in:
parent
318efa8093
commit
bdfb370f19
@ -27,7 +27,7 @@
|
|||||||
hasGroups=hasGroups
|
hasGroups=hasGroups
|
||||||
usernames=emailOrUsername
|
usernames=emailOrUsername
|
||||||
placeholderKey=placeholderKey
|
placeholderKey=placeholderKey
|
||||||
allowEmails=true
|
allowEmails=canInviteViaEmail
|
||||||
class="invite-user-input"
|
class="invite-user-input"
|
||||||
autocomplete="discourse"
|
autocomplete="discourse"
|
||||||
value=emailOrUsername
|
value=emailOrUsername
|
||||||
|
22
test/javascripts/integration/components/invite-panel-test.js
Normal file
22
test/javascripts/integration/components/invite-panel-test.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import EmberObject, { set } from "@ember/object";
|
||||||
|
import componentTest from "helpers/component-test";
|
||||||
|
|
||||||
|
moduleForComponent("invite-panel", { integration: true });
|
||||||
|
|
||||||
|
componentTest("can_invite_via_email", {
|
||||||
|
template: "{{invite-panel panel=panel}}",
|
||||||
|
|
||||||
|
beforeEach() {
|
||||||
|
set(this.currentUser, "details", { can_invite_via_email: true });
|
||||||
|
const inviteModel = JSON.parse(JSON.stringify(this.currentUser));
|
||||||
|
this.set("panel", {
|
||||||
|
id: "invite",
|
||||||
|
model: { inviteModel: EmberObject.create(inviteModel) },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async test(assert) {
|
||||||
|
await fillIn(".invite-user-input", "eviltrout@example.com");
|
||||||
|
assert.ok(find(".send-invite:disabled").length === 0);
|
||||||
|
},
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user