修改完成
This commit is contained in:
+3
-1
@@ -25,6 +25,7 @@
|
||||
</div>
|
||||
<div class="auth-body">
|
||||
<form id="registerForm" autocomplete="off">
|
||||
<input type="hidden" id="inviteCode" name="inviteCode" />
|
||||
<div class="form-group" id="nickNameContainer">
|
||||
<label for="nickName">昵称</label>
|
||||
<input
|
||||
@@ -651,7 +652,7 @@
|
||||
},
|
||||
getOptionalGraphVerifyParams(),
|
||||
);
|
||||
const inviteCode = AuthPageUtil.getReferralInviteCodeFromUrl();
|
||||
const inviteCode = $("#inviteCode").val().trim();
|
||||
if (inviteCode) registerData.inviteCode = inviteCode;
|
||||
return registerData;
|
||||
}
|
||||
@@ -720,6 +721,7 @@
|
||||
|
||||
layui.use(["layer", "jquery"], function () {
|
||||
layerInstance = layui.layer;
|
||||
$("#inviteCode").val(AuthPageUtil.getReferralInviteCodeFromUrl());
|
||||
loadVerifyConfig().then(refreshCaptcha);
|
||||
$("#sendSmsBtn").on("click", sendSmsCode);
|
||||
$("#registerForm").on("submit", function (event) {
|
||||
|
||||
+5
-2
@@ -37,7 +37,7 @@
|
||||
<div class="error-message" id="phoneError"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="captchaGroup" style="visibility: hidden">
|
||||
<div class="form-group" id="captchaGroup" style="display: none">
|
||||
<label for="captchaInput">滑动验证</label>
|
||||
<div class="captcha-row">
|
||||
<input
|
||||
@@ -158,7 +158,6 @@
|
||||
}
|
||||
|
||||
function refreshCaptcha() {
|
||||
$("#captchaGroup").css("visibility", "visible");
|
||||
currentCaptchaId = "";
|
||||
currentSlideUuid = "";
|
||||
currentSlideX = 0;
|
||||
@@ -168,8 +167,10 @@
|
||||
$("#sendSmsBtn").prop("disabled", false);
|
||||
if (currentVerifyType === "slide") {
|
||||
renderSlideCaptchaEntry();
|
||||
$("#captchaGroup").hide();
|
||||
return;
|
||||
}
|
||||
$("#captchaGroup").show();
|
||||
$("#captchaInput").show();
|
||||
$("#captchaRefreshLink").show().text("看不清?换一张");
|
||||
$("#captchaContainer")
|
||||
@@ -304,6 +305,7 @@
|
||||
if (smsCodeIssuedPhone && smsCodeIssuedPhone !== phone) {
|
||||
smsCodeIssuedPhone = "";
|
||||
$("#smsCode").val("");
|
||||
refreshCaptcha();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +484,7 @@
|
||||
.then(function (res) {
|
||||
if (ApiClient.isSuccess(res)) {
|
||||
smsCodeIssuedPhone = $("#phone").val().trim();
|
||||
$("#captchaGroup").hide();
|
||||
layerInstance.msg("短信验证码已发送", { icon: 1 });
|
||||
AuthPageUtil.startSmsCountdown("#sendSmsBtn");
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,9 @@ vm.runInNewContext(`${authSource}\nthis.AuthPageUtilForTest = AuthPageUtil;`, co
|
||||
|
||||
assert.strictEqual(context.AuthPageUtilForTest.getReferralInviteCodeFromUrl(), "invite-001");
|
||||
assert.strictEqual(context.AuthPageUtilForTest.getReferralInviteCodeFromUrl("?referralCode=legacy"), "");
|
||||
assert(register.includes('type="hidden" id="inviteCode" name="inviteCode"'));
|
||||
assert(register.includes('$("#inviteCode").val(AuthPageUtil.getReferralInviteCodeFromUrl());'));
|
||||
assert(register.includes('const inviteCode = $("#inviteCode").val().trim();'));
|
||||
assert(register.includes("registerData.inviteCode = inviteCode"), "registration must send a non-empty inviteCode");
|
||||
assert(register.includes('$("#captchaGroup").hide();'), "registration verification must hide after SMS is sent");
|
||||
assert(register.includes('$("#captchaGroup").show();'), "registration verification must return after the phone changes");
|
||||
@@ -36,7 +39,10 @@ assert(usercenter.includes("ApiClient.API.referralBind, { inviteCode: inviteCode
|
||||
assert(promo.includes("NavigationUtil.referralRegisterUrl"), "promotion page must normalize returned links to registration");
|
||||
assert(login.includes('id="captchaGroup" style="display: none"'));
|
||||
assert(login.includes('$("#captchaGroup").show();'));
|
||||
[register, resetPassword].forEach(function (page) {
|
||||
assert(resetPassword.includes('id="captchaGroup" style="display: none"'));
|
||||
assert(resetPassword.includes('$("#captchaGroup").hide();'));
|
||||
assert(resetPassword.includes('$("#captchaGroup").show();'));
|
||||
[register].forEach(function (page) {
|
||||
assert(page.includes('id="captchaGroup" style="visibility: hidden"'));
|
||||
assert(page.includes('$("#captchaGroup").css("visibility", "visible");'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user