Remove password reset functionality
Backend: - Remove ForgotPassword API handler - Remove password reset token model and database table - Remove email service for sending reset emails - Remove SMTP configuration Frontend: - Remove /auth/forgot page - Remove forgot password link from login page - Remove forgot route from auth-only routes check
This commit is contained in:
parent
c459cc1efb
commit
abd7e3a97f
9 changed files with 5 additions and 425 deletions
|
|
@ -113,19 +113,6 @@ type ImcLoginAttempt struct {
|
|||
// TableName specifies the database table name for ImcLoginAttempt.
|
||||
func (ImcLoginAttempt) TableName() string { return "imc_login_attempts" }
|
||||
|
||||
// PasswordResetToken stores one-time tokens for password reset functionality.
|
||||
type PasswordResetToken struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"` // Primary key
|
||||
UserID uint `gorm:"not null" json:"userId"` // Foreign key to ImcUser
|
||||
Token string `gorm:"size:64;not null;uniqueIndex" json:"token"` // The reset token (unique index for fast lookup)
|
||||
ExpiresAt time.Time `gorm:"not null" json:"expiresAt"` // When this token expires
|
||||
Used bool `gorm:"default:false" json:"used"` // Whether this token has been used
|
||||
CreatedAt time.Time `json:"createdAt"` // When the token was created
|
||||
}
|
||||
|
||||
// TableName specifies the database table name for PasswordResetToken.
|
||||
func (PasswordResetToken) TableName() string { return "imc_password_reset_tokens" }
|
||||
|
||||
// =============================================================================
|
||||
// Helper/View Models (not stored in database)
|
||||
// =============================================================================
|
||||
|
|
@ -258,19 +245,5 @@ func (d *DB) InitSchema() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Create imc_password_reset_tokens table for password reset functionality.
|
||||
// Stores temporary tokens for resetting forgotten passwords.
|
||||
resetTokensSQL := `
|
||||
CREATE TABLE IF NOT EXISTS imc_password_reset_tokens (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT UNSIGNED NOT NULL,
|
||||
token VARCHAR(64) NOT NULL UNIQUE,
|
||||
expires_at DATETIME NOT NULL,
|
||||
used BOOLEAN DEFAULT FALSE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_token (token),
|
||||
INDEX idx_user_id (user_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
|
||||
`
|
||||
return d.Exec(resetTokensSQL).Error
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue