Hide password sign-up routings when it's disabled

This commit is contained in:
Kitaiti Makoto 2022-01-12 08:46:11 +09:00
parent 13f7734751
commit 7de37bc9b7

View file

@ -18,9 +18,19 @@ use crate::utils::requires_login;
use plume_common::activity_pub::{broadcast, ActivityStream, ApRequest, Id}; use plume_common::activity_pub::{broadcast, ActivityStream, ApRequest, Id};
use plume_common::utils::md_to_html; use plume_common::utils::md_to_html;
use plume_models::{ use plume_models::{
blogs::Blog, db_conn::DbConn, follows, headers::Headers, inbox::inbox as local_inbox, blogs::Blog,
instance::Instance, medias::Media, posts::Post, reshares::Reshare, safe_string::SafeString, db_conn::DbConn,
signups::Strategy as SignupStrategy, users::*, Error, PlumeRocket, CONFIG, follows,
headers::Headers,
inbox::inbox as local_inbox,
instance::Instance,
medias::Media,
posts::Post,
reshares::Reshare,
safe_string::SafeString,
signups::{self, Strategy as SignupStrategy},
users::*,
Error, PlumeRocket, CONFIG,
}; };
#[get("/me")] #[get("/me")]
@ -466,6 +476,7 @@ pub fn create(
form: LenientForm<NewUserForm>, form: LenientForm<NewUserForm>,
conn: DbConn, conn: DbConn,
rockets: PlumeRocket, rockets: PlumeRocket,
_enabled: signups::Password,
) -> Result<Flash<Redirect>, Ructe> { ) -> Result<Flash<Redirect>, Ructe> {
if !Instance::get_local() if !Instance::get_local()
.map(|i| i.open_registrations) .map(|i| i.open_registrations)