Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit e4926c2

Browse files
author
David Robertson
committed
Ooops, use Strict* types for EmailRequestTokenBody
1 parent ba71e02 commit e4926c2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

synapse/rest/client/models.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
from typing import TYPE_CHECKING, Optional
1515

16-
from pydantic import BaseModel, Extra, StrictStr, constr, validator
16+
from pydantic import BaseModel, Extra, StrictStr, constr, validator, StrictInt
1717

1818
from synapse.util.threepids import validate_email
1919

@@ -32,13 +32,16 @@ class EmailRequestTokenBody(BaseModel):
3232
else:
3333
# See also assert_valid_client_secret()
3434
client_secret: constr(
35-
regex="[0-9a-zA-Z.=_-]", min_length=0, max_length=255 # noqa: F722
35+
regex="[0-9a-zA-Z.=_-]", # noqa: F722
36+
min_length=0,
37+
max_length=255,
38+
strict=True,
3639
)
37-
email: str
38-
id_access_token: Optional[str]
39-
id_server: Optional[str]
40-
next_link: Optional[str]
41-
send_attempt: int
40+
email: StrictStr
41+
id_access_token: Optional[StrictStr]
42+
id_server: Optional[StrictStr]
43+
next_link: Optional[StrictStr]
44+
send_attempt: StrictInt
4245

4346
# Canonicalise the email address. The addresses are all stored canonicalised
4447
# in the database. This allows the user to reset his password without having to

0 commit comments

Comments
 (0)