core&ui: add login methods to response body (#1165)

This commit is contained in:
Baoshuo authored and GitHub committed 2026-05-24 22:52:08 +08:00
1 parent bbd7fbc852
commit ce14b98184
5 files changed
+9 -5

No files matched your search

+1
View File
@@ -204,6 +204,7 @@ class HomeSecurityHandler extends Handler {
])),
geoipProvider: this.ctx.get('geoip')?.provider,
relations,
loginMethods: this.loginMethods,
};
}
+4 -1
View File
@@ -48,7 +48,10 @@ class UserLoginHandler extends Handler {
async get() {
this.response.template = 'user_login.html';
this.response.body.loginMethods = this.loginMethods;
this.response.body = {
builtInLogin: system.get('server.login'),
loginMethods: this.loginMethods,
};
}
@param('uname', Types.Username)
@@ -70,7 +70,7 @@
<form method="post">
<input type="hidden" name="operation" value="unlink_account">
{%- for relation in relations -%}{% if relation.platform != 'mail' %}
{% set platform = handler.loginMethods.find(eval("r => r.id === '" + relation.platform + "'")) %}
{% set platform = loginMethods.find(eval("r => r.id === '" + relation.platform + "'")) %}
<li class="platform-list__item">
<div class="media">
{% if platform.icon %}
@@ -88,7 +88,7 @@
</form>
<form method="post">
<input type="hidden" name="operation" value="link_account">
{%- for method in handler.loginMethods -%}
{%- for method in loginMethods -%}
{%- if not relations.some(eval("r => r.platform === '" + method.id + "'")) -%}
<li class="platform-list__item">
<div class="media">
@@ -40,7 +40,7 @@
<input type="submit" value="{{ _('Login') }}" name="login_submit" class="expanded rounded primary button">
</div></div>
{% endif %}
{%- for v in handler.loginMethods -%}
{%- for v in loginMethods -%}
<div class="row"><div class="columns">
<a href="{{ url('user_oauth', type=v.id) }}" class="expanded rounded button">{{ _(v.text) }}</a>
</div></div>
@@ -30,7 +30,7 @@
</div>
</div></div>
{% endif %}
{%- for v in handler.loginMethods -%}
{%- for v in loginMethods -%}
<div class="row"><div class="columns">
<a href="{{ url('user_oauth', type=v.id) }}" class="expanded rounded button inverse">{{ _(v.text) }}</a>
</div></div>