first commit
This commit is contained in:
14
templates/socialaccount/authentication_error.html
Executable file
14
templates/socialaccount/authentication_error.html
Executable file
@@ -0,0 +1,14 @@
|
||||
{% extends "socialaccount/base_entrance.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Third-Party Login Failure" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Third-Party Login Failure" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% trans "An error occurred while attempting to login via your third-party account." %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
1
templates/socialaccount/base_entrance.html
Executable file
1
templates/socialaccount/base_entrance.html
Executable file
@@ -0,0 +1 @@
|
||||
{% extends "allauth/layouts/entrance.html" %}
|
||||
1
templates/socialaccount/base_manage.html
Executable file
1
templates/socialaccount/base_manage.html
Executable file
@@ -0,0 +1 @@
|
||||
{% extends "allauth/layouts/manage.html" %}
|
||||
54
templates/socialaccount/connections.html
Executable file
54
templates/socialaccount/connections.html
Executable file
@@ -0,0 +1,54 @@
|
||||
{% extends "socialaccount/base_manage.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Account Connections" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Account Connections" %}
|
||||
{% endelement %}
|
||||
{% if form.accounts %}
|
||||
{% element p %}
|
||||
{% blocktrans %}You can sign in to your account using any of the following third-party accounts:{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% url 'socialaccount_connections' as action_url %}
|
||||
{% element form form=form method="post" action=action_url %}
|
||||
{% slot body %}
|
||||
{% csrf_token %}
|
||||
{% for acc in form.fields.account.choices %}
|
||||
{% with account=acc.0.instance.get_provider_account %}
|
||||
{% setvar radio_id %}
|
||||
id_account_{{ account.account.pk }}
|
||||
{% endsetvar %}
|
||||
{% setvar tags %}
|
||||
socialaccount,{{ account.account.provider }}
|
||||
{% endsetvar %}
|
||||
{% element field id=radio_id type="radio" name="account" value=account.account.pk %}
|
||||
{% slot label %}
|
||||
{{ account }}
|
||||
{% element badge tags=tags %}
|
||||
{{ account.get_brand.name }}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endslot %}
|
||||
{% slot actions %}
|
||||
{% element button tags="delete,danger" type="submit" %}
|
||||
{% trans 'Remove' %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% else %}
|
||||
{% element p %}
|
||||
{% trans 'You currently have no third-party accounts connected to this account.' %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% element h2 %}
|
||||
{% trans 'Add a Third-Party Account' %}
|
||||
{% endelement %}
|
||||
{% include "socialaccount/snippets/provider_list.html" with process="connect" %}
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
{% endblock content %}
|
||||
4
templates/socialaccount/email/account_connected_message.txt
Executable file
4
templates/socialaccount/email/account_connected_message.txt
Executable file
@@ -0,0 +1,4 @@
|
||||
{% extends "account/email/base_notification.txt" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block notification_message %}{% blocktrans %}A third-party account from {{ provider }} has been connected to your account.{% endblocktrans %}{% endblock notification_message %}
|
||||
4
templates/socialaccount/email/account_connected_subject.txt
Executable file
4
templates/socialaccount/email/account_connected_subject.txt
Executable file
@@ -0,0 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% autoescape off %}
|
||||
{% blocktrans %}Third-Party Account Connected{% endblocktrans %}
|
||||
{% endautoescape %}
|
||||
4
templates/socialaccount/email/account_disconnected_message.txt
Executable file
4
templates/socialaccount/email/account_disconnected_message.txt
Executable file
@@ -0,0 +1,4 @@
|
||||
{% extends "account/email/base_notification.txt" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block notification_message %}{% blocktrans %}A third-party account from {{ provider }} has been disconnected from your account.{% endblocktrans %}{% endblock notification_message %}
|
||||
4
templates/socialaccount/email/account_disconnected_subject.txt
Executable file
4
templates/socialaccount/email/account_disconnected_subject.txt
Executable file
@@ -0,0 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% autoescape off %}
|
||||
{% blocktrans %}Third-Party Account Disconnected{% endblocktrans %}
|
||||
{% endautoescape %}
|
||||
134
templates/socialaccount/login.html
Executable file
134
templates/socialaccount/login.html
Executable 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>
|
||||
15
templates/socialaccount/login_cancelled.html
Executable file
15
templates/socialaccount/login_cancelled.html
Executable file
@@ -0,0 +1,15 @@
|
||||
{% extends "socialaccount/base_entrance.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Login Cancelled" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Login Cancelled" %}
|
||||
{% endelement %}
|
||||
{% url 'account_login' as login_url %}
|
||||
{% element p %}
|
||||
{% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to <a href="{{login_url}}">sign in</a>.{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
13
templates/socialaccount/login_redirect.html
Executable file
13
templates/socialaccount/login_redirect.html
Executable file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{% load i18n allauth %}
|
||||
<head>
|
||||
<title>{% translate "Sign In" %} | {{ provider }}</title>
|
||||
<meta http-equiv="refresh" content="0;URL='{{ redirect_to }}'" />
|
||||
</head>
|
||||
<body>
|
||||
{% element p %}
|
||||
<a href="{{ redirect_to }}">{% translate "Continue" %}</a>
|
||||
{% endelement %}
|
||||
</body>
|
||||
</html>
|
||||
2
templates/socialaccount/messages/account_connected.txt
Executable file
2
templates/socialaccount/messages/account_connected.txt
Executable file
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account has been connected.{% endblocktrans %}
|
||||
2
templates/socialaccount/messages/account_connected_other.txt
Executable file
2
templates/socialaccount/messages/account_connected_other.txt
Executable file
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account is already connected to a different account.{% endblocktrans %}
|
||||
1
templates/socialaccount/messages/account_connected_updated.txt
Executable file
1
templates/socialaccount/messages/account_connected_updated.txt
Executable file
@@ -0,0 +1 @@
|
||||
{% extends "socialaccount/messages/account_connected.txt" %}
|
||||
2
templates/socialaccount/messages/account_disconnected.txt
Executable file
2
templates/socialaccount/messages/account_disconnected.txt
Executable file
@@ -0,0 +1,2 @@
|
||||
{% load i18n %}
|
||||
{% blocktrans %}The third-party account has been disconnected.{% endblocktrans %}
|
||||
29
templates/socialaccount/signup.html
Executable file
29
templates/socialaccount/signup.html
Executable file
@@ -0,0 +1,29 @@
|
||||
{% extends "socialaccount/base_entrance.html" %}
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% block head_title %}
|
||||
{% trans "Signup" %}
|
||||
{% endblock head_title %}
|
||||
{% block content %}
|
||||
{% element h1 %}
|
||||
{% trans "Sign Up" %}
|
||||
{% endelement %}
|
||||
{% element p %}
|
||||
{% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to
|
||||
{{site_name}}. As a final step, please complete the following form:{% endblocktrans %}
|
||||
{% endelement %}
|
||||
{% url 'socialaccount_signup' 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 "Sign Up" %}
|
||||
{% endelement %}
|
||||
{% endslot %}
|
||||
{% endelement %}
|
||||
{% endblock content %}
|
||||
15
templates/socialaccount/snippets/login.html
Executable file
15
templates/socialaccount/snippets/login.html
Executable file
@@ -0,0 +1,15 @@
|
||||
{% load i18n %}
|
||||
{% load allauth %}
|
||||
{% load socialaccount %}
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
{% if not SOCIALACCOUNT_ONLY %}
|
||||
{% element hr %}
|
||||
{% endelement %}
|
||||
{% element h2 %}
|
||||
{% translate "Or use a third-party" %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
{% endif %}
|
||||
2
templates/socialaccount/snippets/login_extra.html
Executable file
2
templates/socialaccount/snippets/login_extra.html
Executable file
@@ -0,0 +1,2 @@
|
||||
{% load socialaccount %}
|
||||
{% providers_media_js %}
|
||||
18
templates/socialaccount/snippets/provider_list.html
Executable file
18
templates/socialaccount/snippets/provider_list.html
Executable file
@@ -0,0 +1,18 @@
|
||||
{% load allauth socialaccount %}
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
{% element provider_list %}
|
||||
{% for provider in socialaccount_providers %}
|
||||
{% if provider.id == "openid" %}
|
||||
{% for brand in provider.get_brands %}
|
||||
{% provider_login_url provider openid=brand.openid_url process=process as href %}
|
||||
{% element provider name=brand.name provider_id=provider.id href=href %}
|
||||
{% endelement %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
|
||||
{% element provider name=provider.name provider_id=provider.id href=href %}
|
||||
{% endelement %}
|
||||
{% endfor %}
|
||||
{% endelement %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user