feat: implemented PasswordResetBegin method in auth service with cooldown for each email being stored in redis
This commit is contained in:
@@ -42,12 +42,12 @@ type AuthController interface {
|
||||
}
|
||||
|
||||
type authControllerImpl struct {
|
||||
authService services.AuthService
|
||||
log *zap.Logger
|
||||
auth services.AuthService
|
||||
}
|
||||
|
||||
func NewAuthController(_log *zap.Logger, as services.AuthService) AuthController {
|
||||
return &authControllerImpl{log: _log, authService: as}
|
||||
func NewAuthController(_log *zap.Logger, _auth services.AuthService) AuthController {
|
||||
return &authControllerImpl{log: _log, auth: _auth}
|
||||
}
|
||||
|
||||
// @Summary Acquire tokens via login credentials (and 2FA code if needed)
|
||||
@@ -65,7 +65,7 @@ func (a *authControllerImpl) Login(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response, err := a.authService.Login(request.Body)
|
||||
response, err := a.auth.Login(request.Body)
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, errs.ErrForbidden) {
|
||||
@@ -134,7 +134,7 @@ func (a *authControllerImpl) RegistrationBegin(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err := a.authService.RegistrationBegin(request.Body)
|
||||
_, err := a.auth.RegistrationBegin(request.Body)
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, errs.ErrUsernameTaken) || errors.Is(err, errs.ErrEmailTaken) {
|
||||
@@ -164,7 +164,7 @@ func (a *authControllerImpl) RegistrationComplete(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
response, err := a.authService.RegistrationComplete(request.Body)
|
||||
response, err := a.auth.RegistrationComplete(request.Body)
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, errs.ErrForbidden) {
|
||||
|
||||
Reference in New Issue
Block a user