feat: Improve the initial setup experience

- Issue a single-use token for initial account creation
- Disable registration through other methods until the first account is made
- Print helpful instructions to the console on the first run
- Improve the welcome message sent in the admin room on first run
This commit is contained in:
Ginger
2026-02-12 18:24:24 -05:00
committed by Ellis Git
parent 11a088be5d
commit 047eba0442
14 changed files with 373 additions and 143 deletions
+6 -2
View File
@@ -30,7 +30,7 @@ use ruma::{
use serde::{Deserialize, Serialize};
use serde_json::json;
use crate::{Dep, account_data, admin, appservice, globals, rooms};
use crate::{Dep, account_data, admin, appservice, firstrun, globals, rooms};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserSuspension {
@@ -55,6 +55,7 @@ struct Services {
globals: Dep<globals::Service>,
state_accessor: Dep<rooms::state_accessor::Service>,
state_cache: Dep<rooms::state_cache::Service>,
firstrun: Dep<firstrun::Service>,
}
struct Data {
@@ -96,6 +97,7 @@ impl crate::Service for Service {
state_accessor: args
.depend::<rooms::state_accessor::Service>("rooms::state_accessor"),
state_cache: args.depend::<rooms::state_cache::Service>("rooms::state_cache"),
firstrun: args.depend::<firstrun::Service>("firstrun"),
},
db: Data {
keychangeid_userid: args.db["keychangeid_userid"].clone(),
@@ -187,7 +189,9 @@ impl Service {
self.db
.userid_origin
.insert(user_id, origin.unwrap_or("password"));
self.set_password(user_id, password).await
self.set_password(user_id, password).await?;
Ok(())
}
/// Deactivate account