mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(api): 🐛 Allow for forcing registrations via OpenID and disabling regular signups
This commit is contained in:
parent
8d2d9bd7fa
commit
32f71b3adf
|
|
@ -94,7 +94,7 @@ bait_user_agents = ["curl", "wget"]
|
||||||
|
|
||||||
[frontend]
|
[frontend]
|
||||||
# Enable custom frontends (warning: not enabling this will make Versia Server only accessible via the Mastodon API)
|
# Enable custom frontends (warning: not enabling this will make Versia Server only accessible via the Mastodon API)
|
||||||
# Frontends also control the OAuth flow, so if you disable this, you will need to use the Mastodon frontend
|
# Frontends also control the OpenID flow, so if you disable this, you will need to use the Mastodon frontend
|
||||||
enabled = true
|
enabled = true
|
||||||
# The URL to reach the frontend at (should be on a local network)
|
# The URL to reach the frontend at (should be on a local network)
|
||||||
url = "http://localhost:3000"
|
url = "http://localhost:3000"
|
||||||
|
|
@ -406,11 +406,11 @@ enabled = []
|
||||||
disabled = []
|
disabled = []
|
||||||
|
|
||||||
[plugins.config."@versia/openid"]
|
[plugins.config."@versia/openid"]
|
||||||
# If enabled, Versia will require users to log in with an OAuth provider
|
# If enabled, Versia will require users to log in with an OpenID provider
|
||||||
forced = false
|
forced = false
|
||||||
|
|
||||||
# Allow registration with OAuth providers
|
# Allow registration with OpenID providers
|
||||||
# Overriden by the signups.registration setting
|
# If signups.registration is false, it will only be possible to register with OpenID
|
||||||
allow_registration = true
|
allow_registration = true
|
||||||
|
|
||||||
# [plugins.config."@versia/openid".keys]
|
# [plugins.config."@versia/openid".keys]
|
||||||
|
|
@ -420,7 +420,7 @@ allow_registration = true
|
||||||
|
|
||||||
# The provider MUST support OpenID Connect with .well-known discovery
|
# The provider MUST support OpenID Connect with .well-known discovery
|
||||||
# Most notably, GitHub does not support this
|
# Most notably, GitHub does not support this
|
||||||
# Redirect URLs in your OAuth provider can be set to this:
|
# Redirect URLs in your OpenID provider can be set to this:
|
||||||
# <base_url>/oauth/sso/<provider_id>/callback*
|
# <base_url>/oauth/sso/<provider_id>/callback*
|
||||||
# The asterisk is important, as it allows for any query parameters to be passed
|
# The asterisk is important, as it allows for any query parameters to be passed
|
||||||
# Authentik for example uses regex so it can be set to (regex):
|
# Authentik for example uses regex so it can be set to (regex):
|
||||||
|
|
|
||||||
|
|
@ -192,10 +192,7 @@ export default (plugin: PluginType): void => {
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
// Register new user
|
// Register new user
|
||||||
if (
|
if (context.get("pluginConfig").allow_registration) {
|
||||||
context.get("config").signups.registration &&
|
|
||||||
context.get("pluginConfig").allow_registration
|
|
||||||
) {
|
|
||||||
let username =
|
let username =
|
||||||
preferred_username ??
|
preferred_username ??
|
||||||
email?.split("@")[0] ??
|
email?.split("@")[0] ??
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue