feat: close registration with ROCKET_REGISTRATION_DISABLED=true
This commit is contained in:
parent
c85d363d71
commit
0067f49d52
3 changed files with 27 additions and 13 deletions
|
@ -117,6 +117,14 @@ pub fn register_route(
|
|||
db: State<'_, Database>,
|
||||
body: Ruma<register::Request>,
|
||||
) -> MatrixResult<register::Response, UiaaResponse> {
|
||||
if db.globals.registration_disabled() {
|
||||
return MatrixResult(Err(UiaaResponse::MatrixError(Error {
|
||||
kind: ErrorKind::Unknown,
|
||||
message: "Registration has been disabled.".to_owned(),
|
||||
status_code: http::StatusCode::FORBIDDEN,
|
||||
})));
|
||||
}
|
||||
|
||||
// Validate user id
|
||||
let user_id = match UserId::parse_with_server_name(
|
||||
body.username
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue