mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 12:25:30 +08:00
FIX: autotracking.mutation-after-consumption
(#24164)
This commit is contained in:
parent
16861f9b3f
commit
08deedfd6e
@ -29,10 +29,4 @@ export default Component.extend({
|
||||
isWebauthnSupported()
|
||||
);
|
||||
},
|
||||
|
||||
actions: {
|
||||
externalLogin(provider) {
|
||||
this.externalLogin(provider);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -16,7 +16,7 @@
|
||||
/>
|
||||
{{#if this.showLoginButtons}}
|
||||
<LoginButtons
|
||||
@externalLogin={{this.externalLogin}}
|
||||
@externalLogin={{this.externalLoginAction}}
|
||||
@passkeyLogin={{this.passkeyLogin}}
|
||||
/>
|
||||
{{/if}}
|
||||
@ -73,7 +73,7 @@
|
||||
{{/unless}}
|
||||
<div class="login-right-side">
|
||||
<LoginButtons
|
||||
@externalLogin={{this.externalLogin}}
|
||||
@externalLogin={{this.externalLoginAction}}
|
||||
@passkeyLogin={{this.passkeyLogin}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -30,8 +30,8 @@ export default class Login extends Component {
|
||||
@tracked showSecondFactor = false;
|
||||
@tracked loginPassword = "";
|
||||
@tracked loginName = "";
|
||||
@tracked flash = this.args.model?.flash;
|
||||
@tracked flashType = this.args.model?.flashType;
|
||||
@tracked flash = this.args.model.flash;
|
||||
@tracked flashType = this.args.model.flashType;
|
||||
@tracked canLoginLocal = this.siteSettings.enable_local_logins;
|
||||
@tracked
|
||||
canLoginLocalWithEmail = this.siteSettings.enable_local_logins_via_email;
|
||||
@ -48,7 +48,8 @@ export default class Login extends Component {
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
if (this.args.model?.isExternalLogin) {
|
||||
|
||||
if (this.args.model.isExternalLogin) {
|
||||
this.externalLogin(this.args.model.externalLoginMethod, {
|
||||
signup: this.args.model.signup,
|
||||
});
|
||||
@ -57,7 +58,7 @@ export default class Login extends Component {
|
||||
|
||||
get awaitingApproval() {
|
||||
return (
|
||||
this.args.model?.awaitingApproval &&
|
||||
this.args.model.awaitingApproval &&
|
||||
!this.canLoginLocal &&
|
||||
!this.canLoginLocalWithEmail
|
||||
);
|
||||
@ -332,12 +333,7 @@ export default class Login extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
async externalLogin(loginMethod, { signup = false } = {}) {
|
||||
if (this.loginDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
async externalLogin(loginMethod, { signup }) {
|
||||
try {
|
||||
this.loggingIn = true;
|
||||
await loginMethod.doLogin({ signup });
|
||||
@ -347,6 +343,15 @@ export default class Login extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
async externalLoginAction(loginMethod) {
|
||||
if (this.loginDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.externalLogin(loginMethod, { signup: false });
|
||||
}
|
||||
|
||||
@action
|
||||
createAccount() {
|
||||
let createAccountProps = {};
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import sinon from "sinon";
|
||||
import LoginMethod from "discourse/models/login-method";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
@ -47,4 +49,17 @@ acceptance("Create Account", function () {
|
||||
.dom("#username-validation")
|
||||
.hasText(I18n.t("user.username.required"), "shows signup error");
|
||||
});
|
||||
|
||||
test("can sign in using a third-party auth", async function (assert) {
|
||||
sinon.stub(LoginMethod, "buildPostForm").callsFake((url) => {
|
||||
assert.step("buildPostForm");
|
||||
assert.strictEqual(url, "/auth/facebook?signup=true");
|
||||
});
|
||||
|
||||
await visit("/");
|
||||
await click("header .sign-up-button");
|
||||
await click("#login-buttons button");
|
||||
|
||||
assert.verifySteps(["buildPostForm"]);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user