Documentation ¶
Index ¶
- func CheckPassword(hashedPassword string, plain string) error
- func HashPassword(plain string) (string, error)
- func RandomNumber(min, max int64) int64
- func RandomPassword() string
- func RandomString(n int, src string) string
- func RandomUsername() string
- type Config
- type EmailSender
- type GmailSender
- type LocalSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
Compares a password hash with a plain string. Returns nil on success, or an error on failure.
func HashPassword ¶
Returns the bcrypt hash of plain
func RandomNumber ¶
Return a random number between max and min
Types ¶
type Config ¶
type Config struct { DBConnString string `mapstructure:"DB_CONNSTRING"` DBMigrationFiles string `mapstructure:"DB_MIGRATION_FILES"` AppURL string `mapstructure:"APP_URL"` ListenAddr string `mapstructure:"LISTEN_ADDR"` ListenPort string `mapstructure:"LISTEN_PORT"` Environment string `mapstructure:"ENVIRONMENT"` SecretKey string `mapstructure:"SECRET_KEY"` AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"` RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"` RedisAddress string `mapstructure:"REDIS_ADDRESS"` EmailSenderName string `mapstructure:"EMAIL_SENDER_NAME"` GmailSenderAddress string `mapstructure:"GMAIL_SENDER_ADDRESS"` GmailSenderPassword string `mapstructure:"GMAIL_SENDER_PASSWORD"` MailhogHost string `mapstructure:"MAILHOG_HOST"` MailhogSenderAddress string `mapstructure:"MAILHOG_SENDER_ADDRESS"` }
func LoadConfig ¶
viper loads values etiher from app.env or from environment variables
type EmailSender ¶
type EmailSender interface {
SendEmail(subject string, content string, to []string, cc []string, bcc []string, attachFiles []string) error
}
func NewGmailSender ¶
func NewGmailSender(senderName string, senderAddress string, senderPassword string) EmailSender
Creates a new Gmail sender
func NewLocalSender ¶
func NewLocalSender(senderName string, senderAddress string, smtpServer string) EmailSender
Creates a new local email sender
type GmailSender ¶
type GmailSender struct {
// contains filtered or unexported fields
}
type LocalSender ¶
type LocalSender struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.