Implement forgot password
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user