first commit
This commit is contained in:
1 parent
78da3838f0
commit
09c86adf7b
486 files changed
+47300
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import re
|
||||
|
||||
class Password(str):
|
||||
def __new__(cls, value: str):
|
||||
cls._validate(value)
|
||||
return super().__new__(cls, value)
|
||||
|
||||
@classmethod
|
||||
def _validate(cls, value: str):
|
||||
if len(value) < 8:
|
||||
raise ValueError("비밀번호는 8자 이상이어야 합니다.")
|
||||
|
||||
if not re.search(r"[A-Z]", value):
|
||||
raise ValueError("비밀번호는 대문자 영어 1개 이상이어야 합니다.")
|
||||
|
||||
if not re.search(r'[!@#$%^&*(),.?":{}|<>]', value):
|
||||
raise ValueError("비밀번호에는 특수문자가 1개 이상 포함되어야 합니다.")
|
||||
@@ -0,0 +1,10 @@
|
||||
import re
|
||||
|
||||
class UserId(str):
|
||||
def __init__(self, value: str):
|
||||
if re.search(r"[^\w가-힣]", value):
|
||||
raise ValueError("아이디에는 특수문자는 사용할 수 없습니다.")
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
@@ -0,0 +1,10 @@
|
||||
import re
|
||||
|
||||
class UserName(str):
|
||||
def __init__(self, value: str):
|
||||
if re.search(r"[^\w가-힣]", value):
|
||||
raise ValueError("이름에는 특수문자는 사용할 수 없습니다.")
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
Reference in new issue
Block a user