feat: registration source selector (netease/skin/java)
This commit is contained in:
@@ -11,9 +11,12 @@ const RegisterPage = {
|
||||
<div class="form-group"><label>站点用户名 *</label><input id="ru" required placeholder="登录用"></div>
|
||||
<div class="form-group"><label>邮箱 *</label><input type="email" id="re" required placeholder="接收通知"></div>
|
||||
</div>
|
||||
<div class="form-group"><label>账号来源</label><select id="rs" onchange="RegisterPage.toggleSource()">
|
||||
<option value="netease">网易端</option><option value="skin">皮肤站</option><option value="java">Java服</option>
|
||||
</select></div>
|
||||
<div class="grid-2">
|
||||
<div class="form-group"><label>游戏名称 *</label><input id="rgn" required placeholder="Minecraft ID"></div>
|
||||
<div class="form-group"><label>游戏UID *</label><input id="rgu" required placeholder="游戏唯一ID"></div>
|
||||
<div class="form-group"><label id="rs-label1">游戏名称 *</label><input id="rgn" required placeholder="Minecraft ID/网易昵称"></div>
|
||||
<div class="form-group"><label id="rs-label2">网易UID *</label><input id="rgu" required placeholder="UID"></div>
|
||||
</div>
|
||||
<div class="form-group"><label>密码 *</label><input type="password" id="rp" required placeholder="至少6位"></div>
|
||||
${this.captcha ? `
|
||||
@@ -37,13 +40,15 @@ const RegisterPage = {
|
||||
</div>`;
|
||||
},
|
||||
|
||||
toggleSource() {
|
||||
const src = document.getElementById('rs').value;
|
||||
const labels = { netease:['游戏名称','网易UID'], skin:['游戏名称','皮肤站UID'], java:['游戏名称','Minecraft UUID'] };
|
||||
document.getElementById('rs-label1').textContent = labels[src][0] + ' *';
|
||||
document.getElementById('rs-label2').textContent = labels[src][1] + ' *';
|
||||
},
|
||||
|
||||
async refreshCaptcha() {
|
||||
try {
|
||||
const c = await API.get('/captcha');
|
||||
document.getElementById('captcha-img').innerHTML = c.svg;
|
||||
document.getElementById('captcha-id').value = c.id;
|
||||
document.getElementById('captcha-a').value = '';
|
||||
} catch {}
|
||||
try { const c = await API.get('/captcha'); document.getElementById('captcha-img').innerHTML = c.svg; document.getElementById('captcha-id').value = c.id; document.getElementById('captcha-a').value = ''; } catch {}
|
||||
},
|
||||
|
||||
mount() {
|
||||
@@ -52,11 +57,9 @@ const RegisterPage = {
|
||||
const btn = e.target.querySelector('button');
|
||||
const err = document.getElementById('regerr');
|
||||
const ok = document.getElementById('regok');
|
||||
err.classList.add('hidden');
|
||||
ok.classList.add('hidden');
|
||||
err.classList.add('hidden'); ok.classList.add('hidden');
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 注册中...';
|
||||
|
||||
try {
|
||||
await Auth.register({
|
||||
username: document.getElementById('ru').value.trim(),
|
||||
@@ -64,19 +67,16 @@ const RegisterPage = {
|
||||
email: document.getElementById('re').value.trim(),
|
||||
game_name: document.getElementById('rgn').value.trim(),
|
||||
game_uid: document.getElementById('rgu').value.trim(),
|
||||
source: document.getElementById('rs').value,
|
||||
captcha_id: document.getElementById('captcha-id')?.value,
|
||||
captcha_answer: document.getElementById('captcha-a')?.value.trim(),
|
||||
});
|
||||
ok.textContent = '注册成功!请查收验证邮件(如SMTP未配置则自动激活)';
|
||||
ok.textContent = '注册成功!' + (document.getElementById('rs').value === 'netease' ? '网易端' : '皮肤站') + '账号已创建,请查收验证邮件或直接登录';
|
||||
ok.classList.remove('hidden');
|
||||
btn.innerHTML = '<i class="fas fa-user-plus"></i> 注册';
|
||||
btn.disabled = false;
|
||||
setTimeout(() => location.hash = '#/login', 3000);
|
||||
} catch (ex) {
|
||||
err.textContent = ex.message;
|
||||
err.classList.remove('hidden');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="fas fa-user-plus"></i> 注册';
|
||||
err.textContent = ex.message; err.classList.remove('hidden');
|
||||
btn.disabled = false; btn.innerHTML = '<i class="fas fa-user-plus"></i> 注册';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user