refactor: Split remote and deactivated users into their own columns

This commit is contained in:
Ginger committed 2026-07-02 16:24:07 -04:00
1 parent d4f6c053bc
commit 69163b5391
32 files changed
+391 -278

No files matched your search

+6 -6
View File
@@ -69,7 +69,7 @@ async fn route_change_password(
let user_card = UserCard::for_local_user(&services, user_id.clone()).await;
let body = if let Some(form) = form {
match change_password(&services, &user_id, form).await {
match change_password(&services, &user_id, form).await? {
| Ok(()) => ChangePasswordBody::Success,
| Err(errors) =>
ChangePasswordBody::Form(ChangePasswordForm::with_errors(context.clone(), errors)),
@@ -85,7 +85,7 @@ async fn change_password(
services: &crate::State,
user_id: &UserId,
form: ChangePasswordForm,
) -> Result<(), ValidationErrors> {
) -> Result<Result<(), ValidationErrors>> {
form.validate()?;
if services
@@ -100,12 +100,12 @@ async fn change_password(
ValidationError::new("wrong").with_message("Incorrect password".into()),
);
return Err(errors);
return Ok(Err(errors));
}
match HashedPassword::new(&form.new_password) {
| Ok(hash) => {
services.users.set_password(user_id, Some(hash));
services.users.set_password(user_id, hash).await?;
},
| Err(err) => {
let mut errors = ValidationErrors::new();
@@ -114,9 +114,9 @@ async fn change_password(
ValidationError::new("malformed").with_message(err.message().into()),
);
return Err(errors);
return Ok(Err(errors));
},
}
Ok(())
Ok(Ok(()))
}
+1 -1
View File
@@ -214,7 +214,7 @@ async fn route_reset_password_validate(
| Ok(hash) => {
let _ = session.consume();
services.users.set_password(&user_id, Some(hash));
services.users.set_password(&user_id, hash).await?;
ResetPasswordValidateBody::ResetSuccess { user_card }
},
+5 -5
View File
@@ -310,7 +310,7 @@ async fn get_register_email_validate(
response!(
complete_registration(&services, session_store, completed_registration, Some(email))
.await
.await?
)
}
@@ -502,7 +502,7 @@ async fn begin_registration(
} else {
// If email isn't required we can immediately complete registration
Ok(response!(
complete_registration(services, session_store, completed_registration, None).await
complete_registration(services, session_store, completed_registration, None).await?
))
}
}
@@ -517,11 +517,11 @@ async fn complete_registration(
next,
}: CompletedRegistration,
email: Option<Address>,
) -> Redirect {
) -> Result<Redirect> {
services
.users
.create_local_account(&user_id, password_hash, email)
.await;
.await?;
if let Some(registration_token) = registration_token {
services
@@ -536,7 +536,7 @@ async fn complete_registration(
.await
.expect("should be able to serialize user session");
Redirect::to(&next.unwrap_or_default().target_path())
Ok(Redirect::to(&next.unwrap_or_default().target_path()))
}
pub(super) async fn registration_flow_status(
+2 -4
View File
@@ -162,10 +162,8 @@ pub(crate) async fn require_active(
user_id: &UserId,
allow_locked: bool,
) -> Result<(), Response> {
if !services.users.is_active(user_id).await {
return Err(
WebError::Forbidden("Your account is deactivated.".to_owned()).into_response()
);
if let Err(err) = services.users.status(user_id).await.ensure_active() {
return Err(WebError::Forbidden(err.message()).into_response());
}
if !allow_locked