Implement forgot password

This commit is contained in:
2020-10-08 20:47:10 +02:00
parent 3be567c8ac
commit 0b53bbaa70
6 changed files with 85 additions and 8 deletions

View File

@@ -32,3 +32,12 @@ def deliver_otp(data: OTPResend, db: Session = Depends(get_db)):
update_otp(data=data, db=db)
response = resend_otp(data=data, db=db)
return response
@router.post("/forgot_password", response_model=ForgotPasswordResponse)
def forgot_password(data: ForgotPassword, db: Session = Depends(get_db)):
mark_password_reset(data=data, db=db)
response = resend_otp(data=data, db=db)
return response

View File

@@ -122,6 +122,22 @@ class OTPResendResponse(UserCreateResponse):
orm_mode = True
class ForgotPassword(BaseModel):
email: EmailStr
class Config:
orm_mode = True
class ForgotPasswordResponse(BaseModel):
otp: int
mobile: str = Query(None, min_length=8, max_length=13)
message: str = "The OTP has been sent to you via SMS"
class Config:
orm_mode = True
access_key: str
otp: int = Query(None, ge=6, le=6)