Add Password Reset Functionality and Update API Documentation
- Implemented password reset functionality, including endpoints for requesting a reset code, verifying the OTP, and resetting the password. - Introduced new request and response forms for password reset operations, ensuring proper validation and structured responses. - Enhanced the customer service layer to handle password reset requests, OTP verification, and password updates, utilizing Redis for temporary token storage. - Updated Swagger and YAML documentation to include new API endpoints and their specifications, improving clarity for API consumers. - Refactored the customer handler to manage new password reset routes, ensuring adherence to clean architecture principles.
This commit is contained in:
@@ -70,3 +70,19 @@ func (c *Customer) GetCreatedAt() int64 {
|
||||
func (c *Customer) GetUpdatedAt() int64 {
|
||||
return c.UpdatedAt
|
||||
}
|
||||
|
||||
// OTP represents a one-time password for password reset
|
||||
type OTP struct {
|
||||
Code string `bson:"code" json:"code"`
|
||||
Email string `bson:"email" json:"email"`
|
||||
ExpiresAt int64 `bson:"expires_at" json:"expires_at"`
|
||||
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
||||
}
|
||||
|
||||
// ResetToken represents a temporary reset token for password reset
|
||||
type ResetToken struct {
|
||||
Token string `bson:"token" json:"token"`
|
||||
Email string `bson:"email" json:"email"`
|
||||
ExpiresAt int64 `bson:"expires_at" json:"expires_at"`
|
||||
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user