From 0b710fd5381b16b3053e9c5dbdbad9bd255832a3 Mon Sep 17 00:00:00 2001 From: Asai Neko Date: Fri, 2 Jan 2026 16:37:30 +0800 Subject: [PATCH] Change magic_link_ttl old name to auth_code_ttl Signed-off-by: Asai Neko --- config.default.yaml | 2 +- config/types.go | 2 +- pkgs/authcode/authcode.go | 2 +- service/auth/magic.go | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index fd663b3..37ba375 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -32,7 +32,7 @@ secrets: turnstile_secret: example client_secret_key: example ttl: - magic_link_ttl: 10m + auth_code_ttl: 10m access_ttl: 15s refresh_ttl: 168h checkin_code_ttl: 10m diff --git a/config/types.go b/config/types.go index e7ddadd..c4af613 100644 --- a/config/types.go +++ b/config/types.go @@ -56,7 +56,7 @@ type secrets struct { } type ttl struct { - MagicLinkTTL string `yaml:"magic_link_ttl"` + AuthCodeTTL string `yaml:"auth_code_ttl"` AccessTTL string `yaml:"access_ttl"` RefreshTTL string `yaml:"refresh_ttl"` CheckinCodeTTL string `yaml:"checkin_code_ttl"` diff --git a/pkgs/authcode/authcode.go b/pkgs/authcode/authcode.go index 7113d3d..56576fe 100644 --- a/pkgs/authcode/authcode.go +++ b/pkgs/authcode/authcode.go @@ -29,7 +29,7 @@ func NewAuthCode(email string) (string, error) { store.Store(code, Token{ Email: email, - ExpiresAt: time.Now().Add(viper.GetDuration("ttl.magic_link_ttl")), + ExpiresAt: time.Now().Add(viper.GetDuration("ttl.auth_code_ttl")), }) return code, nil diff --git a/service/auth/magic.go b/service/auth/magic.go index f3f47d7..d60d625 100644 --- a/service/auth/magic.go +++ b/service/auth/magic.go @@ -49,6 +49,7 @@ func Magic(c *gin.Context) { query.Set("code", code) query.Set("redirect_uri", req.RedirectUri) query.Set("state", req.State) + query.Set("client_id", req.ClientId) url.RawQuery = query.Encode() debugMode := viper.GetBool("server.debug_mode")