Merge pull request #2224 from lyen1688/feat-email-oauth-github-google
feat: 增加 GitHub 和 Google 邮箱快捷登录
This commit is contained in:
27
backend/migrations/135_allow_email_oauth_provider_types.sql
Normal file
27
backend/migrations/135_allow_email_oauth_provider_types.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
ALTER TABLE users
|
||||
DROP CONSTRAINT IF EXISTS users_signup_source_check;
|
||||
|
||||
ALTER TABLE users
|
||||
ADD CONSTRAINT users_signup_source_check
|
||||
CHECK (signup_source IN ('email', 'linuxdo', 'wechat', 'oidc', 'github', 'google'));
|
||||
|
||||
ALTER TABLE auth_identities
|
||||
DROP CONSTRAINT IF EXISTS auth_identities_provider_type_check;
|
||||
|
||||
ALTER TABLE auth_identities
|
||||
ADD CONSTRAINT auth_identities_provider_type_check
|
||||
CHECK (provider_type IN ('email', 'linuxdo', 'wechat', 'oidc', 'github', 'google'));
|
||||
|
||||
ALTER TABLE auth_identity_channels
|
||||
DROP CONSTRAINT IF EXISTS auth_identity_channels_provider_type_check;
|
||||
|
||||
ALTER TABLE auth_identity_channels
|
||||
ADD CONSTRAINT auth_identity_channels_provider_type_check
|
||||
CHECK (provider_type IN ('email', 'linuxdo', 'wechat', 'oidc', 'github', 'google'));
|
||||
|
||||
ALTER TABLE pending_auth_sessions
|
||||
DROP CONSTRAINT IF EXISTS pending_auth_sessions_provider_type_check;
|
||||
|
||||
ALTER TABLE pending_auth_sessions
|
||||
ADD CONSTRAINT pending_auth_sessions_provider_type_check
|
||||
CHECK (provider_type IN ('email', 'linuxdo', 'wechat', 'oidc', 'github', 'google'));
|
||||
@@ -142,3 +142,16 @@ func TestMigration134AddsAffiliateLedgerAuditFieldsWithoutJSONCast(t *testing.T)
|
||||
require.Contains(t, sql, "COUNT(*) OVER (PARTITION BY ual.id) AS ledger_match_count")
|
||||
require.NotContains(t, sql, "detail::jsonb")
|
||||
}
|
||||
|
||||
func TestMigration135AllowsGitHubAndGoogleAuthProviders(t *testing.T) {
|
||||
content, err := FS.ReadFile("135_allow_email_oauth_provider_types.sql")
|
||||
require.NoError(t, err)
|
||||
|
||||
sql := string(content)
|
||||
require.Contains(t, sql, "users_signup_source_check")
|
||||
require.Contains(t, sql, "auth_identities_provider_type_check")
|
||||
require.Contains(t, sql, "auth_identity_channels_provider_type_check")
|
||||
require.Contains(t, sql, "pending_auth_sessions_provider_type_check")
|
||||
require.Contains(t, sql, "'github'")
|
||||
require.Contains(t, sql, "'google'")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user