mobile app models chat login notifications themes
This commit is contained in:
@@ -40,6 +40,10 @@
|
||||
<button type="button" id="send-sms-btn" onclick="handleSendSms()" class="relative inline-flex items-center px-4 py-2 border border-slate-300 text-sm font-medium rounded-r-md text-slate-700 bg-slate-50 hover:bg-slate-100">获取验证码</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<input id="remember-phone" type="checkbox" class="h-4 w-4 text-primary focus:ring-primary border-slate-300 rounded">
|
||||
<label for="remember-phone" class="ml-2 block text-sm text-slate-700">保持登录10天</label>
|
||||
</div>
|
||||
<button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-blue-700">登录</button>
|
||||
</form>
|
||||
<!-- 邮箱登录表单 -->
|
||||
@@ -52,6 +56,10 @@
|
||||
<label class="block text-sm font-medium text-slate-700">密码</label>
|
||||
<input id="login-password" type="password" required class="mt-1 focus:ring-primary focus:border-primary block w-full pl-3 sm:text-sm border-slate-300 rounded-md py-2 border" placeholder="请输入密码">
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<input id="remember-email" type="checkbox" class="h-4 w-4 text-primary focus:ring-primary border-slate-300 rounded">
|
||||
<label for="remember-email" class="ml-2 block text-sm text-slate-700">保持登录10天</label>
|
||||
</div>
|
||||
<button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-blue-700">登录</button>
|
||||
</form>
|
||||
<div class="mt-6 relative">
|
||||
@@ -112,8 +120,9 @@ async function handlePhoneLogin(e) {
|
||||
e.preventDefault();
|
||||
const phone = document.getElementById('phone').value;
|
||||
const code = document.getElementById('sms-code').value;
|
||||
const remember = document.getElementById('remember-phone').checked;
|
||||
try {
|
||||
const res = await fetch('/api/verify-code', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({phone, code}) });
|
||||
const res = await fetch('/api/verify-code', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({phone, code, remember}) });
|
||||
const data = await res.json();
|
||||
if (data.success) { window.location.href = '/'; }
|
||||
else alert(data.message);
|
||||
@@ -124,8 +133,9 @@ async function handleEmailLogin(e) {
|
||||
e.preventDefault();
|
||||
const email = document.getElementById('login-email').value;
|
||||
const password = document.getElementById('login-password').value;
|
||||
const remember = document.getElementById('remember-email').checked;
|
||||
try {
|
||||
const res = await fetch('/api/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({email, password}) });
|
||||
const res = await fetch('/api/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({email, password, remember}) });
|
||||
const data = await res.json();
|
||||
if (data.success) { window.location.href = '/'; }
|
||||
else alert(data.message);
|
||||
|
||||
Reference in New Issue
Block a user