Documentation
¶
Index ¶
- func HashPassword(password string) (string, error)
- func VerifyPassword(hashedPassword, password string) bool
- type AuthResponse
- type ChangePasswordRequest
- type Config
- type LoginRequest
- type Manager
- func (m *Manager) ChangePassword(userID string, req ChangePasswordRequest) error
- func (m *Manager) ChangePasswordHandler() gin.HandlerFunc
- func (m *Manager) DeleteAccount(userID string) error
- func (m *Manager) DeleteAccountHandler() gin.HandlerFunc
- func (m *Manager) GenerateToken(userID string) (string, error)
- func (m *Manager) GetProfileHandler() gin.HandlerFunc
- func (m *Manager) GetUserByEmail(email string) (*User, error)
- func (m *Manager) GetUserByID(userID string) (*User, error)
- func (m *Manager) Login(req LoginRequest) (*User, string, error)
- func (m *Manager) LoginHandler() gin.HandlerFunc
- func (m *Manager) Middleware() gin.HandlerFunc
- func (m *Manager) Signup(req SignupRequest) (*User, string, error)
- func (m *Manager) SignupHandler() gin.HandlerFunc
- func (m *Manager) UpdateProfile(userID string, req UpdateProfileRequest) (*User, error)
- func (m *Manager) UpdateProfileHandler() gin.HandlerFunc
- func (m *Manager) ValidateToken(tokenString string) (string, error)
- type SignupRequest
- type UpdateProfileRequest
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
HashPassword hashes password using bcrypt
func VerifyPassword ¶
VerifyPassword checks if password matches the hash
Types ¶
type AuthResponse ¶
AuthResponse
type ChangePasswordRequest ¶
type ChangePasswordRequest struct {
OldPassword string `json:"old_password"`
NewPassword string `json:"new_password"`
}
ChangePasswordRequest
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) ChangePassword ¶
func (m *Manager) ChangePassword(userID string, req ChangePasswordRequest) error
ChangePassword changes user password
func (*Manager) ChangePasswordHandler ¶
func (m *Manager) ChangePasswordHandler() gin.HandlerFunc
ChangePasswordHandler changes user password
func (*Manager) DeleteAccount ¶
DeleteAccount deletes user account
func (*Manager) DeleteAccountHandler ¶
func (m *Manager) DeleteAccountHandler() gin.HandlerFunc
DeleteAccountHandler deletes user account
func (*Manager) GenerateToken ¶
GenerateToken creates a JWT token for the user
func (*Manager) GetProfileHandler ¶
func (m *Manager) GetProfileHandler() gin.HandlerFunc
GetProfileHandler returns current user profile
func (*Manager) GetUserByEmail ¶
GetUserByEmail finds a user by email
func (*Manager) GetUserByID ¶
GetUserByID finds a user by ID
func (*Manager) Login ¶
func (m *Manager) Login(req LoginRequest) (*User, string, error)
Login authenticates a user
func (*Manager) LoginHandler ¶
func (m *Manager) LoginHandler() gin.HandlerFunc
LoginHandler returns Gin handler for login
func (*Manager) Middleware ¶
func (m *Manager) Middleware() gin.HandlerFunc
Middleware returns auth middleware for protected routes
func (*Manager) Signup ¶
func (m *Manager) Signup(req SignupRequest) (*User, string, error)
Signup creates a new user account
func (*Manager) SignupHandler ¶
func (m *Manager) SignupHandler() gin.HandlerFunc
SignupHandler returns Gin handler for signup
func (*Manager) UpdateProfile ¶
func (m *Manager) UpdateProfile(userID string, req UpdateProfileRequest) (*User, error)
UpdateProfile updates user's custom fields
func (*Manager) UpdateProfileHandler ¶
func (m *Manager) UpdateProfileHandler() gin.HandlerFunc
UpdateProfileHandler updates user profile
type SignupRequest ¶
SignupRequest
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Custom map[string]interface{} `json:"custom"`
}
UpdateProfileRequest