On branch main
modified: internal/domain/auth/dto.go modified: internal/domain/auth/handler.go modified: internal/domain/auth/router.go modified: internal/domain/auth/servcie.go modified: internal/middleware/auth.go modified: internal/router/router.go auth implemented without reset password
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// dto.go
|
||||
package auth
|
||||
|
||||
import (
|
||||
@@ -21,10 +22,16 @@ type LoginRequest struct {
|
||||
|
||||
// AuthResponse структура ответа при успешной аутентификации
|
||||
type AuthResponse struct {
|
||||
Token string `json:"token"`
|
||||
RefreshToken string `json:"refresh_token,omitempty"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
User UserInfo `json:"user"`
|
||||
Token string `json:"token"` // Access token для Bearer авторизации
|
||||
ExpiresAt time.Time `json:"expires_at"` // Время истечения access token
|
||||
User UserInfo `json:"user"`
|
||||
}
|
||||
|
||||
// RefreshTokenResponse структура ответа при обновлении токена
|
||||
type RefreshTokenResponse struct {
|
||||
Token string `json:"token"` // Новый access token
|
||||
ExpiresAt time.Time `json:"expires_at"` // Время истечения нового access token
|
||||
User UserInfo `json:"user"`
|
||||
}
|
||||
|
||||
// ResetPasswordRequest - запрос на сброс пароля
|
||||
@@ -32,7 +39,7 @@ type ResetPasswordRequest struct {
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
}
|
||||
|
||||
// RefreshTokenRequest - запрос на обновление токена
|
||||
// RefreshTokenRequest - запрос на обновление токена (только для мобильных приложений)
|
||||
type RefreshTokenRequest struct {
|
||||
RefreshToken string `json:"refresh_token" validate:"required"`
|
||||
}
|
||||
@@ -57,4 +64,6 @@ var (
|
||||
ErrUserNotFound = errors.New("user not found")
|
||||
ErrInvalidPassword = errors.New("invalid password")
|
||||
ErrUserAlreadyExists = errors.New("user with this email already exists")
|
||||
)
|
||||
ErrInvalidToken = errors.New("invalid token")
|
||||
ErrTokenExpired = errors.New("token expired")
|
||||
)
|
||||
Reference in New Issue
Block a user