mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-12 02:19:59 +08:00
- 重构 README.md,更新项目描述、结构、配置说明和 API 端点信息。 - 在 .env.example 中添加 MySQL 数据库配置项。 - 将数据库连接池回收时间从 1 小时减少到 30 分钟 (app/database/connection.py)。 - 修复认证成功后的重定向 URL,从 /keys 指向 /config (app/router/routes.py)。 - 微调认证页面的背景透明度 (app/templates/auth.html)。 - 添加 cryptography 依赖以支持 MySQL 8+ 认证 (requirements.txt)。 - 添加示例图片文件 (files/image*.png)。
125 lines
4.9 KiB
HTML
125 lines
4.9 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}验证页面 - Gemini Balance{% endblock %}
|
|
|
|
{% block head_extra_styles %}
|
|
<style>
|
|
/* auth.html specific styles */
|
|
.auth-glass-card { /* Renamed to avoid conflict if base.html has .glass-card */
|
|
background: rgba(255, 255, 255, 0.85); /* Increased opacity */
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
}
|
|
.auth-bg-gradient { /* Renamed to avoid conflict if base.html has .bg-gradient */
|
|
background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
|
|
}
|
|
/* .input-icon class removed, using direct Tailwind classes now */
|
|
/* Keep button ripple effect if needed, or remove if base provides similar */
|
|
.auth-button { /* Renamed to avoid conflict */
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
.auth-button:after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
width: 0;
|
|
height: 0;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border-radius: 50%;
|
|
transform: translate(-50%, -50%);
|
|
transition: width 0.6s, height 0.6s;
|
|
}
|
|
.auth-button:active:after {
|
|
width: 300px;
|
|
height: 300px;
|
|
opacity: 0;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="auth-bg-gradient min-h-screen flex flex-col justify-center items-center p-4">
|
|
<div class="glass-card rounded-2xl shadow-2xl p-10 max-w-md w-full mx-auto transform transition duration-500 hover:-translate-y-1 hover:shadow-3xl animate-fade-in">
|
|
<div class="flex justify-center mb-8 animate-slide-down">
|
|
<div class="rounded-full bg-primary-100 p-4 text-primary-600">
|
|
<i class="fas fa-shield-alt text-4xl"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="text-3xl font-extrabold text-center text-transparent bg-clip-text bg-gradient-to-r from-primary-600 to-primary-700 mb-8 animate-slide-down">
|
|
<img src="/static/icons/logo.png" alt="Gemini Balance Logo" class="h-9 inline-block align-middle mr-2">
|
|
Gemini Balance
|
|
</h2>
|
|
|
|
<form id="auth-form" action="/auth" method="post" class="space-y-6 animate-slide-up">
|
|
<div class="relative">
|
|
<i class="fas fa-key absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500"></i>
|
|
<input
|
|
type="password"
|
|
id="auth-token"
|
|
name="auth_token"
|
|
required
|
|
placeholder="请输入验证令牌"
|
|
class="w-full pl-10 pr-4 py-4 rounded-xl border border-gray-300 focus:border-primary-500 focus:ring focus:ring-primary-200 focus:ring-opacity-50 transition duration-300 bg-white bg-opacity-90 text-gray-700"
|
|
>
|
|
</div>
|
|
|
|
<button
|
|
type="submit"
|
|
class="w-full py-4 rounded-xl bg-gradient-to-r from-primary-600 to-primary-700 text-white font-semibold transition duration-300 transform hover:-translate-y-1 hover:shadow-lg"
|
|
>
|
|
登录
|
|
</button>
|
|
</form>
|
|
|
|
{% if error %}
|
|
<p class="mt-4 text-red-500 text-center font-medium p-3 bg-red-50 rounded-lg border border-red-200 animate-shake">
|
|
{{ error }}
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</div> <!-- Close auth-bg-gradient div -->
|
|
<!-- Notification placeholder for base.html's showNotification -->
|
|
<div id="notification" class="notification"></div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block body_scripts %}
|
|
<script>
|
|
// auth.html specific JavaScript
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const form = document.getElementById('auth-form');
|
|
if (form) {
|
|
form.addEventListener('submit', function(e) {
|
|
const token = document.getElementById('auth-token').value.trim();
|
|
if (!token) {
|
|
e.preventDefault();
|
|
// Use the base notification system
|
|
showNotification('请输入验证令牌', 'error');
|
|
}
|
|
});
|
|
}
|
|
// Apply renamed classes
|
|
document.querySelectorAll('button[type="submit"]').forEach(button => {
|
|
button.classList.add('auth-button');
|
|
});
|
|
const card = document.querySelector('.auth-glass-card'); // Find the renamed card
|
|
if (card) {
|
|
// If the base template also defines .glass-card, remove it first
|
|
// card.classList.remove('glass-card');
|
|
} else {
|
|
// If the card wasn't found by the new name, try the old name and rename
|
|
const oldCard = document.querySelector('.glass-card');
|
|
if (oldCard) {
|
|
oldCard.classList.remove('glass-card');
|
|
oldCard.classList.add('auth-glass-card');
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %}
|