add proxy site login entry

This commit is contained in:
doubaniux 2020-07-05 14:15:36 +08:00
parent a021ec63ba
commit f4f7a14f2a
3 changed files with 12 additions and 3 deletions

View file

@ -86,7 +86,7 @@ if DEBUG:
'NAME': 'test',
'USER': 'donotban',
'PASSWORD': 'donotbansilvousplait',
'HOST': '172.18.99.149',
'HOST': '172.17.132.10',
'OPTIONS': {
'client_encoding': 'UTF8',
# 'isolation_level': psycopg2.extensions.ISOLATION_LEVEL_DEFAULT,

View file

@ -26,7 +26,9 @@
{% if user.is_authenticated %}
<a href="{% url 'common:home' %}" class="button">{% trans '前往我的主页' %}</a>
{% else %}
<a href="{{ oauth_auth_url }}" class="button">{% trans '使用长毛象授权登录' %}</a>
<a href="{{ oauth_url }}" class="button">{% trans '使用长毛象授权登录' %}</a>
<br>
<a href="{{ proxy_site_oauth_url }}" class="button">{% trans '礼貌站登录入口' %}</a>
{% endif %}
</div>

View file

@ -59,6 +59,12 @@ def login(request):
f"client_id={CLIENT_ID}&scope=read+write&" +\
f"redirect_uri=https://{request.get_host()}{reverse('users:OAuth2_login')}" +\
"&response_type=code"
proxy_site_auth_url = f"https://pleasedonotban.com{API_OAUTH_AUTHORIZE}?" +\
f"client_id={CLIENT_ID}&scope=read+write&" +\
f"redirect_uri=https://{request.get_host()}{reverse('users:OAuth2_login')}" +\
"&response_type=code"
from boofilsic.settings import DEBUG
if DEBUG:
auth_url = f"https://{MASTODON_DOMAIN_NAME}{API_OAUTH_AUTHORIZE}?" +\
@ -70,7 +76,8 @@ def login(request):
request,
'users/login.html',
{
'oauth_auth_url': auth_url
'oauth_url': auth_url,
'proxy_site_oauth_url': proxy_site_auth_url
}
)
else: