mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-29 20:07:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b732c3ad8a |
No files matched your search
@@ -1959,10 +1959,8 @@
|
|||||||
#
|
#
|
||||||
#sender =
|
#sender =
|
||||||
|
|
||||||
# Whether to allow public registration with an email address.
|
# Whether to require that users provide an email address when they
|
||||||
#
|
# register.
|
||||||
# Note that, if this option is enabled, anyone will be able to register an
|
|
||||||
# account with just an email address.
|
|
||||||
#
|
#
|
||||||
# If either this option or `require_email_for_token_registration` are set,
|
# If either this option or `require_email_for_token_registration` are set,
|
||||||
# users will not be allowed to remove their email address.
|
# users will not be allowed to remove their email address.
|
||||||
@@ -1970,7 +1968,6 @@
|
|||||||
#require_email_for_registration = false
|
#require_email_for_registration = false
|
||||||
|
|
||||||
# Whether to require that users who register with a registration token
|
# Whether to require that users who register with a registration token
|
||||||
# provide an email address. This option is independent of
|
# provide an email address.
|
||||||
# `require_email_for_registration`.
|
|
||||||
#
|
#
|
||||||
#require_email_for_token_registration = false
|
#require_email_for_token_registration = false
|
||||||
+17
-4
@@ -9,6 +9,7 @@ use ruma::{
|
|||||||
AccessToken, AccessTokenOptional, AppserviceToken, AppserviceTokenOptional,
|
AccessToken, AccessTokenOptional, AppserviceToken, AppserviceTokenOptional,
|
||||||
AuthScheme, NoAccessToken, NoAuthentication,
|
AuthScheme, NoAccessToken, NoAuthentication,
|
||||||
},
|
},
|
||||||
|
client,
|
||||||
federation::authentication::ServerSignatures,
|
federation::authentication::ServerSignatures,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -116,10 +117,9 @@ impl CheckAuth for AccessToken {
|
|||||||
.await
|
.await
|
||||||
.is_ok_and(std::convert::identity)
|
.is_ok_and(std::convert::identity)
|
||||||
{
|
{
|
||||||
if !(route == TypeId::of::<ruma::api::client::session::logout::v3::Request>()
|
if !(route == TypeId::of::<client::session::logout::v3::Request>()
|
||||||
|| route
|
|| route == TypeId::of::<client::session::logout_all::v3::Request>())
|
||||||
== TypeId::of::<ruma::api::client::session::logout_all::v3::Request>(
|
{
|
||||||
)) {
|
|
||||||
return Err!(Request(Unauthorized("Your account is locked.")));
|
return Err!(Request(Unauthorized("Your account is locked.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,6 +258,19 @@ impl CheckAuth for NoAccessToken {
|
|||||||
err!(Request(Unauthorized(warn!("Failed to extract authorization: {}", err))))
|
err!(Request(Unauthorized(warn!("Failed to extract authorization: {}", err))))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
// Check special access restrictions
|
||||||
|
if (route == TypeId::of::<client::profile::get_avatar_url::v3::Request>()
|
||||||
|
|| route == TypeId::of::<client::profile::get_display_name::v3::Request>()
|
||||||
|
|| route == TypeId::of::<client::profile::get_profile_field::v3::Request>()
|
||||||
|
|| route == TypeId::of::<client::profile::get_profile::v3::Request>())
|
||||||
|
&& services.config.require_auth_for_profile_requests
|
||||||
|
&& token.is_none()
|
||||||
|
{
|
||||||
|
return Err!(Request(Unauthorized(
|
||||||
|
"This server requires authentication to access user profiles."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
<AccessTokenOptional as CheckAuth>::verify(services, token, request, query, route).await
|
<AccessTokenOptional as CheckAuth>::verify(services, token, request, query, route).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2318,10 +2318,8 @@ pub struct SmtpConfig {
|
|||||||
/// - `address@domain.org` to not use a name
|
/// - `address@domain.org` to not use a name
|
||||||
pub sender: Mailbox,
|
pub sender: Mailbox,
|
||||||
|
|
||||||
/// Whether to allow public registration with an email address.
|
/// Whether to require that users provide an email address when they
|
||||||
///
|
/// register.
|
||||||
/// Note that, if this option is enabled, anyone will be able to register an
|
|
||||||
/// account with just an email address.
|
|
||||||
///
|
///
|
||||||
/// If either this option or `require_email_for_token_registration` are set,
|
/// If either this option or `require_email_for_token_registration` are set,
|
||||||
/// users will not be allowed to remove their email address.
|
/// users will not be allowed to remove their email address.
|
||||||
@@ -2331,8 +2329,7 @@ pub struct SmtpConfig {
|
|||||||
pub require_email_for_registration: bool,
|
pub require_email_for_registration: bool,
|
||||||
|
|
||||||
/// Whether to require that users who register with a registration token
|
/// Whether to require that users who register with a registration token
|
||||||
/// provide an email address. This option is independent of
|
/// provide an email address.
|
||||||
/// `require_email_for_registration`.
|
|
||||||
///
|
///
|
||||||
/// default: false
|
/// default: false
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|||||||
Reference in new issue
Block a user