注册码选填
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
<h1>注册新用户</h1>
|
||||
<form id="regForm">
|
||||
{% csrf_token %}
|
||||
<label for="code">注册码</label>
|
||||
<input id="code" name="code" type="text" required />
|
||||
<label for="code">注册码(选填)</label>
|
||||
<input id="code" name="code" type="text" />
|
||||
<label for="email">邮箱</label>
|
||||
<input id="email" name="email" type="email" required />
|
||||
<button id="sendCodeBtn" type="button">发送验证码</button>
|
||||
@@ -37,7 +37,7 @@
|
||||
<button id="regBtn" type="submit">注册</button>
|
||||
<div id="error" class="error"></div>
|
||||
</form>
|
||||
<div class="hint">仅允许持有管理员提供注册码的学生注册</div>
|
||||
<div class="hint">有注册码请填写,否则可留空</div>
|
||||
</div>
|
||||
<script>
|
||||
function getCookie(name){const v=`; ${document.cookie}`;const p=v.split(`; ${name}=`);if(p.length===2) return p.pop().split(';').shift();}
|
||||
@@ -50,7 +50,7 @@
|
||||
const email_code=(document.getElementById('email_code').value||'').trim();
|
||||
const password=document.getElementById('password').value||'';
|
||||
const confirm=document.getElementById('confirm').value||'';
|
||||
if(!code||!email||!email_code||!username||!password){err.textContent='请填写所有字段';return;}
|
||||
if(!email||!email_code||!username||!password){err.textContent='请填写所有必填字段';return;}
|
||||
if(password!==confirm){err.textContent='两次密码不一致';return;}
|
||||
const btn=document.getElementById('regBtn'); btn.disabled=true;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user