mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 12:16:54 +00:00
fix: Properly show email in account page when OIDC email_claim is set
This commit is contained in:
4 files changed
+19
-4
No files matched your search
@@ -33,7 +33,9 @@ pub enum EmailRequirement {
|
||||
Required,
|
||||
/// Users may change or remove their email.
|
||||
Optional,
|
||||
/// Users may not change their email at all.
|
||||
/// Users may see their email, but may not change it.
|
||||
Locked,
|
||||
/// Email features are disabled.
|
||||
Unavailable,
|
||||
}
|
||||
|
||||
@@ -43,6 +45,9 @@ impl EmailRequirement {
|
||||
|
||||
#[must_use]
|
||||
pub fn may_remove(&self) -> bool { matches!(self, Self::Optional) }
|
||||
|
||||
#[must_use]
|
||||
pub fn may_view(&self) -> bool { !matches!(self, Self::Unavailable) }
|
||||
}
|
||||
|
||||
struct Data {
|
||||
@@ -91,7 +96,7 @@ impl Service {
|
||||
&& matches!(oidc.profile_key_import_mode, OidcProfileKeyImportMode::OnLogin)
|
||||
&& oidc.email_claim.is_some()
|
||||
{
|
||||
EmailRequirement::Unavailable
|
||||
EmailRequirement::Locked
|
||||
} else if smtp.require_email_for_registration
|
||||
|| smtp.require_email_for_token_registration
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user