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