Documentation
¶
Index ¶
- func AddPendingReset(email string, reset PendingReset)
- func AddPendingUser(email string, user PendingUser)
- func CleanupExpiredCache()
- func CleanupExpiredRegistrations()
- func CleanupExpiredResets()
- func DeletePendingReset(email string)
- func DeletePendingUser(email string)
- func GenerateOTP() string
- func GenerateRefreshToken(userID uint) (string, time.Time, error)
- func GenerateToken(userID uint, role string) (string, error)
- func IncrementPendingResetAttempts(email string)
- func IncrementPendingUserAttempts(email string)
- type Claims
- type PendingReset
- type PendingUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupExpiredCache ¶
func CleanupExpiredCache()
func CleanupExpiredResets ¶
func CleanupExpiredResets()
func DeletePendingReset ¶
func DeletePendingReset(email string)
func DeletePendingUser ¶
func DeletePendingUser(email string)
func GenerateRefreshToken ¶
GenerateRefreshToken generates a refresh token
func GenerateToken ¶
GenerateToken generates a JWT token for a user
func IncrementPendingResetAttempts ¶
func IncrementPendingResetAttempts(email string)
func IncrementPendingUserAttempts ¶
func IncrementPendingUserAttempts(email string)
Types ¶
type Claims ¶
type Claims struct { UserID uint `json:"user_id"` Role string `json:"role"` TokenType string `json:"token_type"` jwt.RegisteredClaims }
Claims represents the JWT claims
type PendingReset ¶
type PendingReset struct { Email string // User's email OTP string // One-time password OTPExpiresAt time.Time // When the OTP expires LastOTPSent time.Time // When the last OTP was sent Attempts int // Number of OTP attempts CreatedAt time.Time // When the reset was initiated }
PendingReset represents a password reset request waiting for OTP verification
func GetPendingReset ¶
func GetPendingReset(email string) (PendingReset, bool)
type PendingUser ¶
type PendingUser struct { Name string // User's name Email string // User's email PasswordHash string // Hashed password OTP string // One-time password OTPExpiresAt time.Time // When the OTP expires LastOTPSent time.Time // When the last OTP was sent Attempts int // Number of OTP attempts CreatedAt time.Time // When the registration was initiated }
PendingUser represents a user waiting for OTP verification during registration
func GetPendingUser ¶
func GetPendingUser(email string) (PendingUser, bool)
Click to show internal directories.
Click to hide internal directories.