mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-07-02 16:38:36 +00:00
add rate limiting for registration token validity
This commit is contained in:
parent
499548321f
commit
613107e7cf
2 changed files with 10 additions and 3 deletions
|
@ -105,13 +105,13 @@ pub struct WellKnownConfig {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Restriction {
|
||||
Registration,
|
||||
Login,
|
||||
RegistrationTokenValidity,
|
||||
|
||||
#[default]
|
||||
#[serde(rename = "")]
|
||||
CatchAll,
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,10 @@ use std::{
|
|||
use dashmap::{mapref::entry::Entry, DashMap};
|
||||
use ruma::{
|
||||
api::{
|
||||
client::{account::register, session::login},
|
||||
client::{
|
||||
account::{check_registration_token_validity, register},
|
||||
session::login,
|
||||
},
|
||||
IncomingRequest, Metadata,
|
||||
},
|
||||
OwnedServerName, OwnedUserId,
|
||||
|
@ -20,6 +23,10 @@ impl From<Metadata> for Restriction {
|
|||
[
|
||||
(register::v3::Request::METADATA, Restriction::Registration),
|
||||
(login::v3::Request::METADATA, Restriction::Login),
|
||||
(
|
||||
check_registration_token_validity::v1::Request::METADATA,
|
||||
Restriction::RegistrationTokenValidity,
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.find(|(other, _)| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue