File tree Expand file tree Collapse file tree 7 files changed +14
-14
lines changed
Expand file tree Collapse file tree 7 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ async fn post_inner(
6262 let query_user = QueryUser :: get_with_email ( conn_lock ! ( context) , & json_login. email ) ?;
6363 query_user. check_is_locked ( ) ?;
6464 #[ cfg( feature = "plus" ) ]
65- query_user. rate_limit ( context) ?;
65+ query_user. rate_limit_auth ( context) ?;
6666
6767 if let Some ( invite) = & json_login. invite {
6868 query_user. accept_invite ( conn_lock ! ( context) , & context. token_key , invite) ?;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ async fn handle_oauth_user(
7474 let query_user = QueryUser :: get_with_email ( conn_lock ! ( context) , & email) ;
7575 let ( user, auth_action) = if let Ok ( query_user) = query_user {
7676 query_user. check_is_locked ( ) ?;
77- query_user. rate_limit ( context) ?;
77+ query_user. rate_limit_auth ( context) ?;
7878
7979 if let Some ( invite) = oauth_state. invite ( ) {
8080 query_user. accept_invite ( conn_lock ! ( context) , & context. token_key , invite) ?;
@@ -104,7 +104,7 @@ async fn handle_oauth_user(
104104 let invited = json_signup. invite . is_some ( ) ;
105105 let insert_user =
106106 InsertUser :: from_json ( conn_lock ! ( context) , & context. token_key , & json_signup) ?;
107- insert_user. rate_limit ( context) ?;
107+ insert_user. rate_limit_auth ( context) ?;
108108
109109 insert_user. notify (
110110 log,
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ async fn post_inner(
6969 let invited = json_signup. invite . is_some ( ) ;
7070 let insert_user = InsertUser :: from_json ( conn_lock ! ( context) , & context. token_key , & json_signup) ?;
7171 #[ cfg( feature = "plus" ) ]
72- insert_user. rate_limit ( context) ?;
72+ insert_user. rate_limit_auth ( context) ?;
7373
7474 let token = context
7575 . token_key
Original file line number Diff line number Diff line change @@ -245,8 +245,8 @@ async fn post_inner(
245245 . rbac
246246 . is_allowed_organization ( auth_user, Permission :: CreateRole , & query_org)
247247 . map_err ( forbidden_error) ?;
248- // Check the rate limit for sending invite emails
249- auth_user. rate_limit_invite_email ( context) ?;
248+ // Check the rate limit for sending invites
249+ auth_user. rate_limit_invites ( context) ?;
250250
251251 let email = json_new_member. email . clone ( ) ;
252252 // If a user already exists for the email then direct them to login.
Original file line number Diff line number Diff line change @@ -256,11 +256,11 @@ impl RateLimiting {
256256 self . request . check_user ( user_uuid)
257257 }
258258
259- pub fn auth_email ( & self , user_uuid : UserUuid ) -> Result < ( ) , HttpError > {
259+ pub fn auth_attempt ( & self , user_uuid : UserUuid ) -> Result < ( ) , HttpError > {
260260 self . email . check_auth ( user_uuid)
261261 }
262262
263- pub fn invite_email ( & self , user_uuid : UserUuid ) -> Result < ( ) , HttpError > {
263+ pub fn send_invite ( & self , user_uuid : UserUuid ) -> Result < ( ) , HttpError > {
264264 self . email . check_invite ( user_uuid)
265265 }
266266
Original file line number Diff line number Diff line change @@ -238,8 +238,8 @@ impl AuthUser {
238238 . collect ( )
239239 }
240240
241- pub fn rate_limit_invite_email ( & self , context : & ApiContext ) -> Result < ( ) , HttpError > {
242- context. rate_limiting . invite_email ( self . user . uuid )
241+ pub fn rate_limit_invites ( & self , context : & ApiContext ) -> Result < ( ) , HttpError > {
242+ context. rate_limiting . send_invite ( self . user . uuid )
243243 }
244244
245245 #[ cfg( feature = "plus" ) ]
Original file line number Diff line number Diff line change @@ -121,8 +121,8 @@ impl QueryUser {
121121
122122 /// Rate limit authentication attempts for this user
123123 #[ cfg( feature = "plus" ) ]
124- pub fn rate_limit ( & self , context : & crate :: ApiContext ) -> Result < ( ) , HttpError > {
125- context. rate_limiting . auth_email ( self . uuid )
124+ pub fn rate_limit_auth ( & self , context : & crate :: ApiContext ) -> Result < ( ) , HttpError > {
125+ context. rate_limiting . auth_attempt ( self . uuid )
126126 }
127127
128128 pub fn accept_invite (
@@ -272,8 +272,8 @@ impl InsertUser {
272272
273273 /// Rate limit authentication attempts for this user
274274 #[ cfg( feature = "plus" ) ]
275- pub fn rate_limit ( & self , context : & crate :: ApiContext ) -> Result < ( ) , HttpError > {
276- context. rate_limiting . auth_email ( self . uuid )
275+ pub fn rate_limit_auth ( & self , context : & crate :: ApiContext ) -> Result < ( ) , HttpError > {
276+ context. rate_limiting . auth_attempt ( self . uuid )
277277 }
278278
279279 pub fn notify (
You can’t perform that action at this time.
0 commit comments