first commit

This commit is contained in:
root
2024-09-20 04:29:09 +00:00
commit 5383007f49
459 changed files with 88755 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{% extends "allauth/layouts/entrance.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% translate "Account Inactive" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% translate "Account Inactive" %}
{% endelement %}
{% element p %}
{% translate "This account is inactive." %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1 @@
{% extends "allauth/layouts/entrance.html" %}

View File

@@ -0,0 +1 @@
{% extends "allauth/layouts/manage.html" %}

View File

@@ -0,0 +1 @@
{% extends "account/base_manage.html" %}

View File

@@ -0,0 +1 @@
{% extends "account/base_manage.html" %}

View File

@@ -0,0 +1,29 @@
{% extends "account/base_entrance.html" %}
{% load allauth %}
{% load i18n %}
{% block head_title %}
{% trans "Confirm Access" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Confirm Access" %}
{% endelement %}
{% element p %}
{% blocktranslate %}Please reauthenticate to safeguard your account.{% endblocktranslate %}
{% endelement %}
{% block reauthenticate_content %}{% endblock %}
{% if reauthentication_alternatives %}
{% element hr %}
{% endelement %}
{% element h2 %}
{% translate "Alternative options" %}
{% endelement %}
{% element button_group %}
{% for alt in reauthentication_alternatives %}
{% element button href=alt.url tags="primary,outline" %}
{{ alt.description }}
{% endelement %}
{% endfor %}
{% endelement %}
{% endif %}
{% endblock content %}

View File

@@ -0,0 +1,37 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth account %}
{% block head_title %}
{% translate "Sign In" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% translate "Enter Sign-In Code" %}
{% endelement %}
{% setvar email_link %}
<a href="mailto:{{ email }}">{{ email }}</a>
{% endsetvar %}
{% element p %}
{% blocktranslate %}Weve sent a code to {{ email_link }}. The code expires shortly, so please enter it soon.{% endblocktranslate %}
{% endelement %}
{% url 'account_confirm_login_code' as login_url %}
{% element form form=form method="post" action=login_url tags="entrance,login" %}
{% slot body %}
{% csrf_token %}
{% element fields form=form unlabeled=True %}
{% endelement %}
{{ redirect_field }}
{% endslot %}
{% slot actions %}
{% element button type="submit" tags="prominent,login" %}
{% translate "Sign In" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% element h2 %}
{% url 'account_login' as login_url %}
{% element button href=login_url tags="link" %}
{% translate "Other sign-in options" %}
{% endelement %}
{% endelement %}
{% endblock content %}

90
templates/account/email.html Executable file
View File

@@ -0,0 +1,90 @@
{% extends "account/base_manage_email.html" %}
{% load allauth i18n %}
{% block head_title %}
{% trans "Email Addresses" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Email Addresses" %}
{% endelement %}
{% if emailaddresses %}
{% element p %}
{% trans 'The following email addresses are associated with your account:' %}
{% endelement %}
{% url 'account_email' as email_url %}
{% element form form=form action=email_url method="post" tags="email,list" %}
{% slot body %}
{% csrf_token %}
{% for radio in emailaddress_radios %}
{% with emailaddress=radio.emailaddress %}
{% element field type="radio" checked=radio.checked name="email" value=emailaddress.email id=radio.id %}
{% slot label %}
{{ emailaddress.email }}
{% if emailaddress.verified %}
{% element badge tags="success,email,verified" %}
{% translate "Verified" %}
{% endelement %}
{% else %}
{% element badge tags="warning,email,unverified" %}
{% translate "Unverified" %}
{% endelement %}
{% endif %}
{% if emailaddress.primary %}
{% element badge tags="email,primary" %}
{% translate "Primary" %}
{% endelement %}
{% endif %}
{% endslot %}
{% endelement %}
{% endwith %}
{% endfor %}
{% endslot %}
{% slot actions %}
{% element button type="submit" name="action_primary" %}
{% trans 'Make Primary' %}
{% endelement %}
{% element button tags="secondary" type="submit" name="action_send" %}
{% trans 'Re-send Verification' %}
{% endelement %}
{% element button tags="danger,delete" type="submit" name="action_remove" %}
{% trans 'Remove' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% else %}
{% include "account/snippets/warn_no_email.html" %}
{% endif %}
{% if can_add_email %}
{% element h2 %}
{% trans "Add Email Address" %}
{% endelement %}
{% url 'account_email' as action_url %}
{% element form form=form method="post" action=action_url tags="email,add" %}
{% slot body %}
{% csrf_token %}
{% element fields form=form %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button name="action_add" type="submit" %}
{% trans "Add Email" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endif %}
{% endblock content %}
{% block extra_body %}
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected email address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock extra_body %}

View File

@@ -0,0 +1,13 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}
{% block content %}{% autoescape off %}{% blocktrans %}You are receiving this email because you or someone else tried to signup for an
account using email address:
{{ email }}
However, an account using that email address already exists. In case you have
forgotten about this, please use the password forgotten procedure to recover
your account:
{{ password_reset_url }}{% endblocktrans %}{% endautoescape %}{% endblock content %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Account Already Exists{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,7 @@
{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %}
{% block content %}{% endblock content %}
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}!
{{ site_domain }}{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,14 @@
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% blocktrans %}You are receiving this mail because the following change was made to your account:{% endblocktrans %}
{% block notification_message %}
{% endblock notification_message%}
{% blocktrans %}If you do not recognize this change then please take proper security precautions immediately. The change to your account originates from:
- IP address: {{ip}}
- Browser: {{user_agent}}
- Date: {{timestamp}}{% endblocktrans %}{% endautoescape %}{% endblock %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Your email has been changed from {{ from_email }} to {{ to_email }}.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Email Changed{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Your email has been confirmed.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Email Confirmation{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,7 @@
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this email because user {{ user_display }} has given your email address to register an account on {{ site_domain }}.
To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock content %}

View File

@@ -0,0 +1 @@
{% include "account/email/email_confirmation_message.txt" %}

View File

@@ -0,0 +1 @@
{% include "account/email/email_confirmation_subject.txt" %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Please Confirm Your Email Address{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Email address {{ deleted_email }} has been removed from your account.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Email Removed{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,9 @@
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% blocktranslate %}Your sign-in code is listed below. Please enter it in your open browser window.{% endblocktranslate %}{% endautoescape %}
{{ code }}
{% blocktranslate %}This mail can be safely ignored if you did not initiate this action.{% endblocktranslate %}{% endblock content %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Sign-In Code{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Your password has been changed.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Changed{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,9 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}
{% block content %}{% autoescape off %}{% blocktrans %}You're receiving this email because you or someone else has requested a password reset for your user account.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %}
{{ password_reset_url }}{% if username %}
{% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock content %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset Email{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Your password has been reset.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Your password has been set.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Set{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,10 @@
{% extends "account/email/base_message.txt" %}
{% load i18n %}
{% block content %}{% autoescape off %}{% blocktranslate %}You are receiving this email because you, or someone else, tried to access an account with email {{ email }}. However, we do not have any record of such an account in our database.{% endblocktranslate %}
{% blocktranslate %}This mail can be safely ignored if you did not initiate this action.{% endblocktranslate %}
{% blocktranslate %}If it was you, you can sign up for an account using the link below.{% endblocktranslate %}
{{ signup_url }}{% endautoescape %}{% endblock content %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Unknown Account{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,68 @@
{% extends "account/base_manage_email.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Email Address" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Email Address" %}
{% endelement %}
{% if not emailaddresses %}
{% include "account/snippets/warn_no_email.html" %}
{% endif %}
{% url 'account_email' as action_url %}
{% element form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{% if current_emailaddress %}
{% element field id="current_email" disabled=True type="email" value=current_emailaddress.email %}
{% slot label %}
{% translate "Current email" %}:
{% endslot %}
{% endelement %}
{% endif %}
{% if new_emailaddress %}
{% element field id="new_email" value=new_emailaddress.email disabled=True type="email" %}
{% slot label %}
{% if not current_emailaddress %}
{% translate "Current email" %}:
{% else %}
{% translate "Changing to" %}:
{% endif %}
{% endslot %}
{% slot help_text %}
{% blocktranslate %}Your email address is still pending verification.{% endblocktranslate %}
{% element button form="pending-email" type="submit" name="action_send" tags="minor,secondary" %}
{% trans 'Re-send Verification' %}
{% endelement %}
{% if current_emailaddress %}
{% element button form="pending-email" type="submit" name="action_remove" tags="danger,minor" %}
{% trans 'Cancel Change' %}
{% endelement %}
{% endif %}
{% endslot %}
{% endelement %}
{% endif %}
{% element field id=form.email.auto_id name="email" value=form.email.value errors=form.email.errors type="email" %}
{% slot label %}
{% translate "Change to" %}:
{% endslot %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button name="action_add" type="submit" %}
{% trans "Change Email" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% if new_emailaddress %}
<form style="display: none"
id="pending-email"
method="post"
action="{% url 'account_email' %}">
{% csrf_token %}
<input type="hidden" name="email" value="{{ new_emailaddress.email }}">
</form>
{% endif %}
{% endblock content %}

View File

@@ -0,0 +1,39 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load account %}
{% load allauth %}
{% block head_title %}
{% trans "Confirm Email Address" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Confirm Email Address" %}
{% endelement %}
{% if confirmation %}
{% user_display confirmation.email_address.user as user_display %}
{% if can_confirm %}
{% element p %}
{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an email address for user {{ user_display }}.{% endblocktrans %}
{% endelement %}
{% url 'account_confirm_email' confirmation.key as action_url %}
{% element form method="post" action=action_url %}
{% slot actions %}
{% csrf_token %}
{{ redirect_field }}
{% element button type="submit" %}
{% trans 'Confirm' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% else %}
{% element p %}
{% blocktrans %}Unable to confirm {{ email }} because it is already confirmed by a different account.{% endblocktrans %}
{% endelement %}
{% endif %}
{% else %}
{% url 'account_email' as email_url %}
{% element p %}
{% blocktrans %}This email confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new email confirmation request</a>.{% endblocktrans %}
{% endelement %}
{% endif %}
{% endblock content %}

127
templates/account/login.html Executable file
View File

@@ -0,0 +1,127 @@
{% load i18n %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>{% trans "Google 登录" %}</title>
<link rel="stylesheet" href="https://file.guimiaokeji.com/layui/css/layui.css">
<style>
body {
background: linear-gradient(to right, #1e3c72, #2a5298);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: 'Arial', sans-serif;
color: #fff;
}
.container {
background: rgba(255, 255, 255, 0.1);
padding: 30px;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 90%;
max-width: 400px;
animation: fadeIn 1s ease-in-out;
backdrop-filter: blur(10px);
text-align: center;
}
.layui-btn {
width: 100%;
}
.title {
font-size: 24px;
margin-bottom: 20px;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
input::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input:-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
.layui-form-item .layui-input {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
}
.layui-form-item .layui-input:focus {
border-color: #3b82ec;
}
.layui-form-label {
color: #fff;
}
.agreement {
display: flex;
align-items: center;
}
.agreement input {
margin-right: 10px;
}
.agreement a {
color: #3b82ec;
text-decoration: underline;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2 class="title">{% trans "通过 Google 登录" %}</h2>
<p>{% trans "您即将使用来自 Google 的第三方账户登录。" %}</p>
<form class="layui-form" method="post" action="{{ form.action }}" id="googleLoginForm">
{% csrf_token %}
<div class="layui-form-item agreement">
<input type="checkbox" id="agreeTerms" lay-skin="primary" lay-verify="required" title="我已阅读并同意">
<label for="agreeTerms"><a href="#" id="termsLink">用户注册条款</a></label>
</div>
<button type="submit" class="layui-btn layui-btn-normal" id="submitButton">{% trans "继续" %}</button>
</form>
</div>
<script src="https://file.guimiaokeji.com/layui/layui.js"></script>
<script>
layui.use(['form', 'layer'], function() {
var form = layui.form;
var layer = layui.layer;
// 打开用户注册条款链接
document.getElementById('termsLink').addEventListener('click', function(event) {
event.preventDefault();
// 在这里打开你的用户注册条款链接
window.open('/path/to/your/terms', '_blank');
});
// 自定义验证规则
form.verify({
required: function(value, item){
if(!$(item).prop('checked')){
return '请阅读并同意用户注册条款后再继续。';
}
}
});
// 监听表单提交
form.on('submit', function(data) {
// 在这里添加处理表单提交的逻辑
return true; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
});
</script>
</body>
</html>

25
templates/account/logout.html Executable file
View File

@@ -0,0 +1,25 @@
{% extends "account/base_manage.html" %}
{% load allauth i18n %}
{% block head_title %}
{% trans "Sign Out" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Sign Out" %}
{% endelement %}
{% element p %}
{% trans 'Are you sure you want to sign out?' %}
{% endelement %}
{% url 'account_logout' as action_url %}
{% element form method="post" action=action_url no_visible_fields=True %}
{% slot body %}
{% csrf_token %}
{{ redirect_field }}
{% endslot %}
{% slot actions %}
{% element button type="submit" %}
{% trans 'Sign Out' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You cannot remove your primary email address ({{email}}).{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Unable to confirm {{email}} because it is already confirmed by a different account.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Confirmation email sent to {{email}}.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have confirmed {{email}}.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Removed email address {{email}}.{% endblocktrans %}

View File

@@ -0,0 +1,4 @@
{% load account %}
{% load i18n %}
{% user_display user as name %}
{% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have signed out.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}A sign-in code has been mailed to {{email}}.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Password successfully changed.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Password successfully set.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Primary email address set.{% endblocktrans %}

View File

@@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Your primary email address must be verified.{% endblocktrans %}

View File

@@ -0,0 +1,25 @@
{% extends "account/base_manage_password.html" %}
{% load allauth i18n %}
{% block head_title %}
{% trans "Change Password" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Change Password" %}
{% endelement %}
{% url 'account_change_password' as action_url %}
{% element form form=form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{{ redirect_field }}
{% element fields form=form %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button type="submit" %}
{% trans "Change Password" %}
{% endelement %}
<a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
{% endslot %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,32 @@
{% extends "account/base_entrance.html" %}
{% load i18n allauth account %}
{% block head_title %}
{% trans "Password Reset" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Password Reset" %}
{% endelement %}
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
{% element p %}
{% trans "Forgotten your password? Enter your email address below, and we'll send you an email allowing you to reset it." %}
{% endelement %}
{% url 'account_reset_password' as reset_url %}
{% element form form=form method="post" action=reset_url %}
{% slot body %}
{% csrf_token %}
{% element fields form=form %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button type="submit" %}
{% trans 'Reset My Password' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% element p %}
{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,18 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% load account %}
{% block head_title %}
{% trans "Password Reset" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Password Reset" %}
{% endelement %}
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
{% element p %}
{% blocktrans %}We have sent you an email. If you have not received it please check your spam folder. Otherwise contact us if you do not receive it in a few minutes.{% endblocktrans %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,35 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Change Password" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% if token_fail %}
{% trans "Bad Token" %}
{% else %}
{% trans "Change Password" %}
{% endif %}
{% endelement %}
{% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %}
{% element p %}
{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}
{% endelement %}
{% else %}
{% element form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{{ redirect_field }}
{% element fields form=form %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button type="submit" name="action" %}
{% trans 'Change Password' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endif %}
{% endblock content %}

View File

@@ -0,0 +1,14 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Change Password" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Change Password" %}
{% endelement %}
{% element p %}
{% trans 'Your password is now changed.' %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,25 @@
{% extends "account/base_manage_password.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Set Password" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Set Password" %}
{% endelement %}
{% url 'account_set_password' as action_url %}
{% element form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{{ redirect_field }}
{% element fields form=form %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button type="submit" name="action" %}
{% trans 'Set Password' %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,22 @@
{% extends "account/base_reauthenticate.html" %}
{% load allauth %}
{% load i18n %}
{% block reauthenticate_content %}
{% element p %}
{% blocktranslate %}Enter your password:{% endblocktranslate %}
{% endelement %}
{% url 'account_reauthenticate' as action_url %}
{% element form form=form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{% element fields form=form unlabeled=True %}
{% endelement %}
{{ redirect_field }}
{% endslot %}
{% slot actions %}
{% element button type="submit" %}
{% trans "Confirm" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endblock %}

View File

@@ -0,0 +1,34 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth account %}
{% block head_title %}
{% translate "Sign In" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% translate "Mail me a sign-in code" %}
{% endelement %}
{% element p %}
{% blocktranslate %}You will receive an email containing a special code for a password-free sign-in.{% endblocktranslate %}
{% endelement %}
{% url 'account_request_login_code' as login_url %}
{% element form form=form method="post" action=login_url tags="entrance,login" %}
{% slot body %}
{% csrf_token %}
{% element fields form=form unlabeled=True %}
{% endelement %}
{{ redirect_field }}
{% endslot %}
{% slot actions %}
{% element button type="submit" tags="prominent,login" %}
{% translate "Request Code" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% element h2 %}
{% url 'account_login' as login_url %}
{% element button href=login_url tags="link" %}
{% translate "Other sign-in options" %}
{% endelement %}
{% endelement %}
{% endblock content %}

38
templates/account/signup.html Executable file
View File

@@ -0,0 +1,38 @@
{% extends "account/base_entrance.html" %}
{% load allauth i18n %}
{% block head_title %}
{% trans "Signup" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Sign Up" %}
{% endelement %}
{% setvar link %}
<a href="{{ login_url }}">
{% endsetvar %}
{% setvar end_link %}
</a>
{% endsetvar %}
{% element p %}
{% blocktranslate %}Already have an account? Then please {{ link }}sign in{{ end_link }}.{% endblocktranslate %}
{% endelement %}
{% if not SOCIALACCOUNT_ONLY %}
{% url 'account_signup' as action_url %}
{% element form form=form method="post" action=action_url tags="entrance,signup" %}
{% slot body %}
{% csrf_token %}
{% element fields form=form unlabeled=True %}
{% endelement %}
{{ redirect_field }}
{% endslot %}
{% slot actions %}
{% element button tags="prominent,signup" type="submit" %}
{% trans "Sign Up" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% endif %}
{% if SOCIALACCOUNT_ENABLED %}
{% include "socialaccount/snippets/login.html" with page_layout="entrance" %}
{% endif %}
{% endblock content %}

View File

@@ -0,0 +1,14 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Sign Up Closed" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Sign Up Closed" %}
{% endelement %}
{% element p %}
{% trans "We are sorry, but the sign up is currently closed." %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,9 @@
{% load i18n %}
{% load account %}
{% load allauth %}
{% user_display user as user_display %}
{% element alert %}
{% slot message %}
<strong>{% blocktranslate %}Note{% endblocktranslate %}:</strong> {% blocktranslate %}You are already logged in as {{ user_display }}.{% endblocktranslate %}
{% endslot %}
{% endelement %}

View File

@@ -0,0 +1,4 @@
{% load i18n allauth %}
{% element p %}
<strong>{% trans 'Warning:' %}</strong> {% trans "You currently do not have any email address set up. You should really add an email address so you can receive notifications, reset your password, etc." %}
{% endelement %}

View File

@@ -0,0 +1,14 @@
{% extends "account/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Verify Your Email Address" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Verify Your Email Address" %}
{% endelement %}
{% element p %}
{% blocktrans %}We have sent an email to you for verification. Follow the link provided to finalize the signup process. If you do not see the verification email in your main inbox, check your spam folder. Please contact us if you do not receive the verification email within a few minutes.{% endblocktrans %}
{% endelement %}
{% endblock content %}

View File

@@ -0,0 +1,25 @@
{% extends "account/base_manage.html" %}
{% load i18n %}
{% load allauth %}
{% block head_title %}
{% trans "Verify Your Email Address" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Verify Your Email Address" %}
{% endelement %}
{% url 'account_email' as email_url %}
{% element p %}
{% blocktrans %}This part of the site requires us to verify that
you are who you claim to be. For this purpose, we require that you
verify ownership of your email address. {% endblocktrans %}
{% endelement %}
{% element p %}
{% blocktrans %}We have sent an email to you for
verification. Please click on the link inside that email. If you do not see the verification email in your main inbox, check your spam folder. Otherwise
contact us if you do not receive it within a few minutes.{% endblocktrans %}
{% endelement %}
{% element p %}
{% blocktrans %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your email address</a>.{% endblocktrans %}
{% endelement %}
{% endblock content %}

123
templates/admin/admin_login.html Executable file
View File

@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>管理员登录</title>
<link rel="stylesheet" href="https://file.guimiaokeji.com/layui/css/layui.css">
<style>
body {
background: linear-gradient(to right, #6a11cb, #2575fc);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: 'Arial', sans-serif;
color: #fff;
}
.login-container {
width: 400px;
padding: 30px;
background: rgba(255, 255, 255, 0.1);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
border-radius: 10px;
animation: fadeIn 1s ease-in-out;
backdrop-filter: blur(10px);
text-align: center;
}
.login-container h2 {
text-align: center;
margin-bottom: 20px;
color: #fff;
}
.layui-btn {
width: 100%;
transition: background 0.3s ease;
}
.layui-btn:hover {
background: linear-gradient(45deg, #3b82ec, #2196f3);
}
.loading {
display: none;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
</head>
<body>
<div class="login-container">
<h2>管理员登录</h2>
<form class="layui-form" id="loginForm">
{% csrf_token %}
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
<input type="password" name="password" required lay-verify="required" placeholder="请输入密码" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="login">登录</button>
</div>
<div id="error-msg" style="display: none;">
<p style="color: red;">用户名或密码错误</p>
</div>
<div class="loading">
<div class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop" style="font-size: 40px;"></div>
<p>登录中,请稍候...</p>
</div>
</form>
</div>
<script src="https://file.guimiaokeji.com/layui/jquery-3.6.0.min.js"></script>
<script src="https://file.guimiaokeji.com/layui/layui.js"></script>
<script>
layui.use(['form', 'layer'], function() {
var form = layui.form;
var layer = layui.layer;
form.on('submit(login)', function(data) {
document.querySelector('.loading').style.display = 'block';
document.getElementById('loginForm').style.display = 'none';
$.ajax({
type: 'POST',
url: '{% url "admin_login" %}',
data: JSON.stringify(data.field),
contentType: 'application/json',
success: function(response) {
document.querySelector('.loading').style.display = 'none';
if (response.code === 200) {
layer.msg(response.message, {icon: 1, time: 2000}, function() {
window.location.href = '{% url "admin_home" %}';
});
} else {
document.getElementById('loginForm').style.display = 'block';
layer.msg(response.message, {icon: 2, time: 2000});
}
},
error: function(xhr, status, error) {
document.querySelector('.loading').style.display = 'none';
document.getElementById('loginForm').style.display = 'block';
layer.msg('登录失败,请稍后重试。', {icon: 2, time: 2000});
}
});
return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
});
</script>
</body>
</html>

1
templates/admin/home.html Executable file
View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>更新密码</title>
<link rel="stylesheet" href="https://file.guimiaokeji.com/layui/css/layui.css">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #f2f2f2;
}
.update-password-container {
width: 400px;
padding: 20px;
background: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
border-radius: 5px;
}
.update-password-container h2 {
text-align: center;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="update-password-container">
<h2>更新密码</h2>
<form class="layui-form" method="post" action="{% url 'update_password' %}">
{% csrf_token %}
<div class="layui-form-item">
{{ form.old_password.label_tag }}
<div class="layui-input-block">
{{ form.old_password }}
</div>
</div>
<div class="layui-form-item">
{{ form.new_password1.label_tag }}
<div class="layui-input-block">
{{ form.new_password1 }}
</div>
</div>
<div class="layui-form-item">
{{ form.new_password2.label_tag }}
<div class="layui-input-block">
{{ form.new_password2 }}
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="update_password">更新密码</button>
</div>
</form>
</div>
<script src="https://file.guimiaokeji.com/layui/layui.js"></script>
<script>
layui.use(['form'], function() {
var form = layui.form;
});
</script>
</body>
</html>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<p>
{% slot message %}
{% endslot %}
</p>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<strong {% if attrs.title %}title="{{ attrs.title }}"{% endif %}>
{% slot %}
{% endslot %}
</strong>

View File

@@ -0,0 +1,13 @@
{% load allauth %}
{% comment %} djlint:off {% endcomment %}
<{% if attrs.href %}a href="{{ attrs.href }}"{% else %}button{% endif %}
{% if attrs.form %}form="{{ attrs.form }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.value %}value="{{ attrs.value }}"{% endif %}
{% if attrs.type %}type="{{ attrs.type }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
>
{% slot %}
{% endslot %}
</{% if attrs.href %}a{% else %}button{% endif %}>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<div>
{% slot %}
{% endslot %}
</div>

View File

@@ -0,0 +1,47 @@
{% load allauth %}
{{ attrs.errors }}
<p>
{% if attrs.type == "textarea" %}
<label for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
<textarea {% if attrs.required %}required{% endif %}
{% if attrs.rows %}rows="{{ attrs.rows }}"{% endif %}
{% if attrs.disabled %}disabled{% endif %}
{% if attrs.readonly %}readonly{% endif %}
{% if attrs.checked %}checked{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}>{% slot value %}{% endslot %}</textarea>
{% else %}
{% if attrs.type != "checkbox" and attrs.type != "radio" %}
<label for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
{% endif %}
<input {% if attrs.required %}required{% endif %}
{% if attrs.disabled %}disabled{% endif %}
{% if attrs.readonly %}readonly{% endif %}
{% if attrs.checked %}checked{% endif %}
{% if attrs.name %}name="{{ attrs.name }}"{% endif %}
{% if attrs.id %}id="{{ attrs.id }}"{% endif %}
{% if attrs.placeholder %}placeholder="{{ attrs.placeholder }}"{% endif %}
{% if attrs.autocomplete %}autocomplete="{{ attrs.autocomplete }}"{% endif %}
{% if attrs.value is not None %}value="{{ attrs.value }}"{% endif %}
type="{{ attrs.type }}">
{% if attrs.type == "checkbox" or attrs.type == "radio" %}
<label for="{{ attrs.id }}">
{% slot label %}
{% endslot %}
</label>
{% endif %}
{% endif %}
{% if slots.help_text %}
<span>
{% slot help_text %}
{% endslot %}
</span>
{% endif %}
</p>

View File

@@ -0,0 +1 @@
{{ attrs.form.as_p }}

View File

@@ -0,0 +1,7 @@
{% load allauth %}
<form method="{{ attrs.method }}" action="{{ attrs.action }}">
{% slot body %}
{% endslot %}
{% slot actions %}
{% endslot %}
</form>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<h1>{% slot %}{% endslot %}</h1>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<h2>{% slot %}{% endslot %}</h2>

View File

@@ -0,0 +1 @@
<hr>

View File

@@ -0,0 +1,2 @@
<img src="{{ attrs.src }}"
{% if attrs.alt %}alt="{{ attrs.alt }}"{% endif %}>

View File

@@ -0,0 +1 @@
{% comment %} djlint:off {% endcomment %}{% load allauth %}<p>{% slot %}{% endslot %}</p>

View File

@@ -0,0 +1,14 @@
{% load allauth %}
<section>
<h2>
{% slot title %}
{% endslot %}
</h2>
{% slot body %}
{% endslot %}
{% if slots.actions %}
<ul>
{% for action in slots.actions %}<li>{{ action }}</li>{% endfor %}
</ul>
{% endif %}
</section>

View File

@@ -0,0 +1,3 @@
<li>
<a title="{{ attrs.name }}" href="{{ attrs.href }}">{{ attrs.name }}</a>
</li>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<ul>
{% slot %}
{% endslot %}
</ul>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<table>
{% slot %}
{% endslot %}
</table>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<tbody>
{% slot %}
{% endslot %}
</tbody>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<td {% if attrs.align %}align="{{ attrs.align }}"{% endif %}>
{% slot %}
{% endslot %}
</td>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<th>
{% slot %}
{% endslot %}
</th>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<thead>
{% slot %}
{% endslot %}
</thead>

View File

@@ -0,0 +1,5 @@
{% load allauth %}
<tr>
{% slot %}
{% endslot %}
</tr>

View File

@@ -0,0 +1,86 @@
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
{% block head_title %}
{% endblock head_title %}
</title>
{% block extra_head %}
{% endblock extra_head %}
</head>
<body>
{% block body %}
{% if messages %}
<div>
<strong>{% trans "Messages:" %}</strong>
<ul>
{% for message in messages %}<li>{{ message }}</li>{% endfor %}
</ul>
</div>
{% endif %}
<div>
<strong>{% trans "Menu:" %}</strong>
<ul>
{% if user.is_authenticated %}
{% url 'account_email' as email_url %}
{% if email_url %}
<li>
<a href="{{ email_url }}">{% trans "Change Email" %}</a>
</li>
{% endif %}
{% url 'account_change_password' as change_password_url %}
{% if change_password_url %}
<li>
<a href="{{ change_password_url }}">{% trans "Change Password" %}</a>
</li>
{% endif %}
{% url 'socialaccount_connections' as connections_url %}
{% if connections_url %}
<li>
<a href="{{ connections_url }}">{% trans "Account Connection" %}</a>
</li>
{% endif %}
{% url 'mfa_index' as mfa_url %}
{% if mfa_url %}
<li>
<a href="{{ mfa_url }}">{% trans "Two-Factor Authentication" %}</a>
</li>
{% endif %}
{% url 'usersessions_list' as usersessions_list_url %}
{% if usersessions_list_url %}
<li>
<a href="{{ usersessions_list_url }}">{% trans "Sessions" %}</a>
</li>
{% endif %}
{% url 'account_logout' as logout_url %}
{% if logout_url %}
<li>
<a href="{{ logout_url }}">{% trans "Sign Out" %}</a>
</li>
{% endif %}
{% else %}
{% url 'account_login' as login_url %}
{% if login_url %}
<li>
<a href="{{ login_url }}">{% trans "Sign In" %}</a>
</li>
{% endif %}
{% url 'account_signup' as signup_url %}
{% if signup_url %}
<li>
<a href="{{ signup_url }}">{% trans "Sign Up" %}</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
{% block content %}
{% endblock content %}
{% endblock body %}
{% block extra_body %}
{% endblock extra_body %}
</body>
</html>

View File

@@ -0,0 +1,2 @@
{% extends "allauth/layouts/base.html" %}
{% block content %}{% endblock %}

View File

@@ -0,0 +1,2 @@
{% extends "allauth/layouts/base.html" %}
{% block content %}{% endblock %}

443
templates/index.html Executable file
View File

@@ -0,0 +1,443 @@
{% load socialaccount %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>登录与注册</title>
<link rel="stylesheet" href="https://file.guimiaokeji.com/layui/css/layui.css">
<style>
body {
background: linear-gradient(to right, #1e3c72, #2a5298);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: 'Arial', sans-serif;
color: #fff;
}
.container {
background: rgba(255, 255, 255, 0.1);
padding: 30px;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 90%;
max-width: 400px;
animation: fadeIn 1s ease-in-out;
backdrop-filter: blur(10px);
}
.layui-form-item {
margin-bottom: 20px;
}
.layui-btn {
width: 100%;
}
.tab-buttons {
display: flex;
justify-content: space-around;
margin-bottom: 20px;
}
.tab-buttons button {
flex: 1;
margin: 0 5px;
}
.login-options {
display: flex;
justify-content: space-between;
}
.login-options button {
width: 48%;
}
.input-with-button {
display: flex;
align-items: center;
}
.input-with-button input {
flex: 3;
}
.input-with-button button {
flex: 1;
margin-left: 10px;
padding: 9px 12px;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.tab-buttons button.active {
background: linear-gradient(45deg, #3b82ec, #2196f3);
color: #fff;
}
.tab-buttons button {
background: rgba(255, 255, 255, 0.1);
color: #fff;
border: none;
transition: all 0.3s;
}
.tab-buttons button:hover {
background: linear-gradient(45deg, #3b82ec, #2196f3);
}
input::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input:-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
.layui-form-item .layui-input {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
}
.layui-form-item .layui-input:focus {
border-color: #3b82ec;
}
.layui-form-label {
color: #fff;
}
.loading-spinner {
display: none;
border: 4px solid rgba(0, 0, 0, 0.1);
border-radius: 50%;
border-top: 4px solid #fff;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<div class="loading-spinner" id="loadingSpinner"></div>
<div class="tab-buttons">
<button class="layui-btn" id="loginTab">登录</button>
<button class="layui-btn" id="registerTab">注册</button>
</div>
<form class="layui-form" id="loginForm">
{% csrf_token %}
<div class="layui-form-item" id="loginFields">
<input type="text" name="login_type" value="password" style="display: none">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="login_username" required lay-verify="required" placeholder="用户名 (邮箱或手机)" class="layui-input" style="margin-bottom: 20px;">
</div>
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
<input type="password" name="login_password" required lay-verify="required" placeholder="密码" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item" id="codeLoginFields" style="display: none;">
<input type="text" name="login_type" value="code" style="display: none">
<label class="layui-form-label">手机号</label>
<div class="layui-input-block input-with-button" style="margin-bottom: 20px;">
<input type="text" name="phone" required lay-verify="required|phone" placeholder="手机号" class="layui-input">
<button type="button" class="layui-btn layui-btn-normal" style="line-height: 10px;" id="sendLoginCode">发送验证码</button>
</div>
<label class="layui-form-label">验证码</label>
<div class="layui-input-block">
<input type="text" name="login_code" required lay-verify="required" placeholder="验证码" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn" type="button" id="loginButton">登录</button>
</div>
<div class="layui-form-item login-options">
<a href="{% provider_login_url 'google' %}" style="width: 48%;"><button type="button" class="layui-btn layui-btn-danger" style="width: 100%;">使用 Google 登录</button></a>
<button type="button" class="layui-btn layui-btn-warm" id="codeLoginButton">验证码登录</button>
</div>
<p><a href="/user/re_password/">忘记密码?</a> </p>
</form>
<form class="layui-form" id="registerForm" style="display: none;">
{% csrf_token %}
<div class="layui-form-item">
<label class="layui-form-label">选择注册方式</label>
<div class="layui-input-block">
<input type="radio" name="registerMethod" value="phone" lay-filter="registerMethod" title="手机号注册" checked>
<input type="radio" name="registerMethod" value="email" lay-filter="registerMethod" title="邮箱注册">
</div>
</div>
<div class="layui-form-item" id="phoneRegister">
<label class="layui-form-label">手机号</label>
<div class="layui-input-block input-with-button">
<input type="text" name="register_phone" id="registerPhoneInput" required lay-verify="required|phone" placeholder="手机号" class="layui-input">
<button type="button" class="layui-btn layui-btn-normal" style="line-height: 10px;" id="sendRegisterPhoneCode">发送验证码</button>
</div>
</div>
<div class="layui-form-item" id="emailRegister" style="display: none;">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block input-with-button">
<input type="email" name="register_email" id="registerEmailInput" required lay-verify="required|email" placeholder="邮箱" class="layui-input">
<button type="button" class="layui-btn layui-btn-normal" style="line-height: 10px;" id="sendRegisterEmailCode">发送验证码</button>
</div>
</div>
<div class="layui-form-item" id="codeRegister">
<label class="layui-form-label">验证码</label>
<div class="layui-input-block">
<input type="text" name="register_code" required lay-verify="required" placeholder="验证码" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="register_username" required lay-verify="required" placeholder="用户名" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
<input type="password" name="register_password" required lay-verify="required" placeholder="密码" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认密码</label>
<div class="layui-input-block">
<input type="password" name="register_confirm_password" required lay-verify="required" placeholder="确认密码" class="layui-input" style="margin-bottom: 20px;">
</div>
</div>
<div class="layui-form-item">
<input type="checkbox" name="agree" lay-skin="primary" title="我已阅读并同意用户注册条款" lay-verify="required">
</div>
<div class="layui-form-item">
<button class="layui-btn" type="button" id="registerButton">注册</button>
</div>
</form>
</div>
<script src="https://file.guimiaokeji.com/layui/jquery-3.6.0.min.js"></script>
<script src="https://file.guimiaokeji.com/layui/layui.js"></script>
<script>
layui.use(['form', 'layer'], function() {
var form = layui.form;
var $ = layui.jquery;
var layer = layui.layer;
var countdown = 60;
var emailTimer, phoneTimer, loginCodeTimer;
// 切换到登录表单
$('#loginTab').on('click', function() {
$('#loginForm').show();
$('#registerForm').hide();
$(this).addClass('active');
$('#registerTab').removeClass('active');
});
// 切换到注册表单
$('#registerTab').on('click', function() {
$('#registerForm').show();
$('#loginForm').hide();
$(this).addClass('active');
$('#loginTab').removeClass('active');
});
// 切换到验证码登录表单
$('#codeLoginButton').on('click', function() {
if ($(this).text() === '验证码登录') {
$('#loginFields').hide();
$('#codeLoginFields').show();
$(this).text('密码登录');
} else {
$('#loginFields').show();
$('#codeLoginFields').hide();
$(this).text('验证码登录');
}
});
// 选择注册方式时切换输入框
form.on('radio(registerMethod)', function(data) {
if (data.value === 'email') {
$('#emailRegister').show();
$('#phoneRegister').hide();
$('#codeRegister').show();
} else {
$('#emailRegister').hide();
$('#phoneRegister').show();
$('#codeRegister').show();
}
});
// 设置验证码按钮倒计时
function setCountdown(button, timer) {
button.prop('disabled', true);
button.text(countdown + 's');
timer = setInterval(function() {
countdown--;
if (countdown <= 0) {
clearInterval(timer);
button.prop('disabled', false);
button.text('发送验证码');
countdown = 60;
} else {
button.text(countdown + 's');
}
}, 1000);
}
// 发送验证码逻辑
function sendCode(button, timer, inputSelector, url) {
var inputValue = $(inputSelector).val();
if (!inputValue) {
layer.msg('请输入正确的' + (inputSelector === '#emailInput' || inputSelector === '#registerEmailInput' ? '邮箱' : '手机号'));
return;
}
setCountdown(button, timer);
console.log("发送验证码到: " + inputValue); // 控制台打印验证码发送信息
$.ajax({
type: 'POST',
url: url,
contentType: 'application/json',
data: JSON.stringify({phone_number: inputValue}),
success: function(response) {
console.log("验证码发送成功", response);
layer.msg('验证码发送成功');
},
error: function(xhr, status, error) {
console.error("验证码发送失败", error);
layer.msg('验证码发送失败');
}
});
}
$('#sendRegisterEmailCode').on('click', function() {
sendCode($(this), emailTimer, '#registerEmailInput', '/api/send-verification-email/');
});
$('#sendRegisterPhoneCode').on('click', function() {
sendCode($(this), phoneTimer, '#registerPhoneInput', '/api/send-verification-sms/');
});
$('#sendLoginCode').on('click', function() {
sendCode($(this), loginCodeTimer, 'input[name="phone"]', '/api/send-verification-sms/');
});
// 显示加载动画
function showLoading() {
$('#loadingSpinner').show();
}
// 隐藏加载动画
function hideLoading() {
$('#loadingSpinner').hide();
}
// 处理登录表单提交逻辑
$('#loginButton').on('click', function() {
var loginData = {
login_type:null,
username: $('input[name="login_username"]').val(),
password: $('input[name="login_password"]').val(),
phone: $('input[name="phone"]').val(),
code: $('input[name="login_code"]').val()
};
console.log(loginData)
if (loginData.username && loginData.password) {
loginData.login_type = 'password'
}
if (loginData.phone && loginData.code) {
loginData.login_type = 'code'
}
showLoading();
$.ajax({
type: 'POST',
url: '/api/login/',
contentType: 'application/json',
data: JSON.stringify(loginData),
success: function(response) {
hideLoading();
console.log("登录成功", response);
if (response.code === 200) {
layer.msg('登录成功,正在跳转', function() {
hideLoading();
window.location.href = '/user/userinfo/';
});
} else {
layer.msg(response.message);
console.error("登录失败", response.message);
}
},
error: function(xhr, status, error) {
hideLoading();
console.error("登录失败", error);
layer.msg('登录失败', error);
}
});
});
// 处理注册表单提交逻辑
$('#registerButton').on('click', function() {
var registerData = {
username: $('input[name="register_username"]').val(),
password: $('input[name="register_password"]').val(),
confirm_password: $('input[name="register_confirm_password"]').val(),
email: $('input[name="register_email"]').val(),
phone: $('input[name="register_phone"]').val(),
code: $('input[name="register_code"]').val(),
registerMethod: $('input[name="registerMethod"]:checked').val()
};
if (!registerData.username || !registerData.password || !registerData.confirm_password || !registerData.code) {
layer.msg('请填写所有必填字段');
return;
}
if (registerData.password !== registerData.confirm_password) {
layer.msg('两次密码输入不一致');
return;
}
showLoading();
$.ajax({
type: 'POST',
url: '/api/register/',
contentType: 'application/json',
data: JSON.stringify(registerData),
success: function(response) {
hideLoading();
console.log("注册成功", response);
if (response.code === 200) {
layer.msg('注册成功,正在登录', function() {
hideLoading();
window.location.href = '/user/userinfo/';
});
} else {
layer.msg(response.message);
console.error(response.message);
}
},
error: function(xhr, status, error) {
hideLoading();
layer.msg('注册失败', error);
console.error("注册失败", error);
}
});
});
// 默认显示登录表单
$('#loginTab').click();
});
</script>
</body>
</html>

134
templates/login.html Executable file
View File

@@ -0,0 +1,134 @@
{% load i18n %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>{% trans "Google 登录" %}</title>
<link rel="stylesheet" href="https://file.guimiaokeji.com/layui/css/layui.css">
<style>
body {
background: linear-gradient(to right, #1e3c72, #2a5298);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: 'Arial', sans-serif;
color: #fff;
}
.container {
background: rgba(255, 255, 255, 0.1);
padding: 30px;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 90%;
max-width: 400px;
animation: fadeIn 1s ease-in-out;
backdrop-filter: blur(10px);
text-align: center;
}
.layui-btn {
width: 100%;
}
.title {
font-size: 24px;
margin-bottom: 20px;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
input::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input:-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::-ms-input-placeholder {
color: rgba(255, 255, 255, 0.7);
}
input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
.layui-form-item .layui-input {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
color: #fff;
}
.layui-form-item .layui-input:focus {
border-color: #3b82ec;
}
.layui-form-label {
color: #fff;
}
.agreement {
display: flex;
align-items: center;
}
.agreement input {
margin-right: 10px;
}
.agreement a {
color: #3b82ec;
text-decoration: underline;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2 class="title">{% trans "通过 Google 登录" %}</h2>
<p>{% trans "您即将使用来自 Google 的第三方账户登录。" %}</p>
<form class="layui-form" method="post" action="{{ form.action }}" id="googleLoginForm">
{% csrf_token %}
<div class="layui-form-item agreement">
<input type="checkbox" id="agreeTerms" lay-skin="primary" lay-verify="checked" title="我已阅读并同意">
<label for="agreeTerms"><a href="#" id="termsLink">用户注册条款</a></label>
</div>
<button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="submitForm">{% trans "继续" %}</button>
</form>
</div>
<script src="https://file.guimiaokeji.com/layui/layui.js"></script>
<script src="https://file.guimiaokeji.com/layui/jquery-3.6.0.min.js"></script>
<script>
layui.use(['form', 'layer'], function() {
var form = layui.form;
var layer = layui.layer;
// 打开用户注册条款链接
document.getElementById('termsLink').addEventListener('click', function(event) {
event.preventDefault();
// 在这里打开你的用户注册条款链接
window.open('/path/to/your/terms', '_blank');
});
// 自定义验证规则
form.verify({
checked: function(value, item){
console.log(1111111111)
console.log(value)
console.log(item)
if(!$('#agreeTerms').prop('checked')){
return '请阅读并同意用户注册条款后再继续。';
}
}
});
// 监听表单提交
form.on('submit(submitForm)', function(data) {
// 在这里添加处理表单提交的逻辑
return true; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
form.render();
});
</script>
</body>
</html>

64
templates/mfa/authenticate.html Executable file
View File

@@ -0,0 +1,64 @@
{% extends "mfa/base_entrance.html" %}
{% load i18n %}
{% load allauth %}
{% load allauth static %}
{% block head_title %}
{% trans "Sign In" %}
{% endblock head_title %}
{% block content %}
{% element h1 %}
{% trans "Two-Factor Authentication" %}
{% endelement %}
{% element p %}
{% blocktranslate %}Your account is protected by two-factor authentication. Please enter an authenticator code:{% endblocktranslate %}
{% endelement %}
{% url 'mfa_authenticate' as action_url %}
{% element form form=form method="post" action=action_url %}
{% slot body %}
{% csrf_token %}
{% element fields form=form unlabeled=True %}
{% endelement %}
{% endslot %}
{% slot actions %}
{% element button type="submit" tags="primary,mfa,login" %}
{% trans "Sign In" %}
{% endelement %}
{% endslot %}
{% endelement %}
{% element hr %}
{% endelement %}
{% element h2 %}
{% translate "Alternative options" %}
{% endelement %}
{% element button_group vertical=True %}
{% if "webauthn" in MFA_SUPPORTED_TYPES %}
{% element button form="webauthn_form" id="mfa_webauthn_authenticate" type="button" tags="outline,primary" %}
{% trans "Use a security key" %}
{% endelement %}
{% endif %}
{% url "account_login" as login_url %}
{% element button href=login_url tags="outline,primary,mfa,cancel" %}
{% trans "Cancel" %}
{% endelement %}
{% endelement %}
{% if "webauthn" in MFA_SUPPORTED_TYPES %}
{% element form id="webauthn_form" form=webauthn_form method="post" action=action_url no_visible_fields=True %}
{% slot body %}
{% csrf_token %}
{% element fields form=webauthn_form %}
{% endelement %}
{% endslot %}
{% endelement %}
{{ js_data|json_script:"js_data" }}
{% include "mfa/webauthn/snippets/scripts.html" %}
<script type="text/javascript">
allauth.webauthn.forms.authenticateForm({
ids: {
authenticate: "mfa_webauthn_authenticate",
credential: "{{ webauthn_form.credential.auto_id }}"
},
data: JSON.parse(document.getElementById('js_data').textContent)
})
</script>
{% endif %}
{% endblock content %}

View File

@@ -0,0 +1 @@
{% extends "allauth/layouts/entrance.html" %}

1
templates/mfa/base_manage.html Executable file
View File

@@ -0,0 +1 @@
{% extends "allauth/layouts/manage.html" %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}A new set of Two-Factor Authentication recovery codes has been generated.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}New Recovery Codes Generated{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,4 @@
{% extends "account/email/base_notification.txt" %}
{% load i18n %}
{% block notification_message %}{% blocktrans %}Authenticator app activated.{% endblocktrans %}{% endblock notification_message %}

View File

@@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Authenticator App Activated{% endblocktrans %}
{% endautoescape %}

Some files were not shown because too many files have changed in this diff Show More