mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-07-17 00:11:55 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4784d48c1 |
@@ -252,6 +252,13 @@ pub(crate) async fn register_route(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't allow registration with user IDs that aren't local
|
||||||
|
if !services.globals.user_is_local(&user_id) {
|
||||||
|
return Err!(Request(InvalidUsername(
|
||||||
|
"Username {body_username} is not local to this server"
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
user_id
|
user_id
|
||||||
},
|
},
|
||||||
| Err(e) => {
|
| Err(e) => {
|
||||||
|
|||||||
@@ -184,6 +184,12 @@ pub async fn create(
|
|||||||
password: Option<&str>,
|
password: Option<&str>,
|
||||||
origin: Option<&str>,
|
origin: Option<&str>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
if !self.services.globals.user_is_local(user_id)
|
||||||
|
&& (password.is_some() || origin.is_some())
|
||||||
|
{
|
||||||
|
return Err!("Cannot create a nonlocal user with a set password or origin");
|
||||||
|
}
|
||||||
|
|
||||||
self.db
|
self.db
|
||||||
.userid_origin
|
.userid_origin
|
||||||
.insert(user_id, origin.unwrap_or("password"));
|
.insert(user_id, origin.unwrap_or("password"));
|
||||||
|
|||||||
Reference in New Issue
Block a user