forbid: type the FORBID kind as an enum at the store boundary, string only in storage
All checks were successful
CI / check (push) Successful in 3m56s

This commit is contained in:
Jean Chevronnet 2026-07-17 13:26:16 +00:00
parent 1fb3615b7e
commit 2c8ba4460d
No known key found for this signature in database
10 changed files with 91 additions and 49 deletions

View file

@ -1,4 +1,4 @@
use echo_api::Store;
use echo_api::{ForbidKind, Store};
use echo_api::{Sender, ServiceCtx};
// SET PASSWORD <newpassword> | SET EMAIL [address]: change your account settings.
@ -30,7 +30,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
let email = args.get(2).map(|s| s.to_string());
let cleared = email.is_none();
if let Some(addr) = &email {
if db.is_forbidden("EMAIL", addr).is_some() {
if db.is_forbidden(ForbidKind::Email, addr).is_some() {
ctx.notice(me, from.uid, "That email address is forbidden by network policy. Use a different one.");
return;
}