File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
crates/handlers/src/views/register/steps Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use axum::{
99 response:: IntoResponse ,
1010} ;
1111use axum_extra:: TypedHeader ;
12+ use chrono:: Duration ;
1213use mas_axum_utils:: { cookies:: CookieJar , FancyError , SessionInfoExt as _} ;
1314use mas_data_model:: UserAgent ;
1415use mas_router:: { PostAuthAction , UrlBuilder } ;
@@ -60,6 +61,14 @@ pub(crate) async fn get(
6061 ) ) ;
6162 }
6263
64+ // Make sure the registration session hasn't expired
65+ // XXX: this duration is hard-coded, could be configurable
66+ if clock. now ( ) - registration. created_at > Duration :: hours ( 1 ) {
67+ return Err ( FancyError :: from ( anyhow:: anyhow!(
68+ "Registration session has expired"
69+ ) ) ) ;
70+ }
71+
6372 // Check that this registration belongs to this browser
6473 let registrations = UserRegistrationSessions :: load ( & cookie_jar) ;
6574 if !registrations. contains ( & registration) {
You can’t perform that action at this time.
0 commit comments