00f6b51228
Implemented email service infrastructure with SMTP support and optional email verification for self-hosted deployments. Registration flow now supports open/closed modes and hardcoded Apocapoc branding. Key features: - Email service with SMTP and template rendering - Optional email verification (auto-verified without SMTP config) - Registration modes: open/closed for access control - Hardcoded Apocapoc branding (AppName, AppURL, DefaultFrom) - Separate registration and login flows (registration no longer returns tokens)
30 lines
614 B
Go
30 lines
614 B
Go
package entities
|
|
|
|
import "time"
|
|
|
|
type User struct {
|
|
ID string
|
|
Email string
|
|
PasswordHash string
|
|
Timezone string
|
|
EmailVerified bool
|
|
EmailVerificationToken *string
|
|
EmailVerificationExpiry *time.Time
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func NewUser(email, passwordHash, timezone string) *User {
|
|
now := time.Now()
|
|
if timezone == "" {
|
|
timezone = "UTC"
|
|
}
|
|
return &User{
|
|
Email: email,
|
|
PasswordHash: passwordHash,
|
|
Timezone: timezone,
|
|
CreatedAt: now,
|
|
UpdatedAt: now,
|
|
}
|
|
}
|