add forget password
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
type Brevo struct {
|
||||
APIKey string `mapstructure:"api_key"`
|
||||
}
|
||||
|
||||
func (b *Brevo) GetApiKey() string {
|
||||
return b.APIKey
|
||||
}
|
||||
@@ -29,6 +29,8 @@ type Config struct {
|
||||
Jwt Jwt `mapstructure:"jwt"`
|
||||
OSSConfig OSSConfig `mapstructure:"oss"`
|
||||
Midtrans Midtrans `mapstructure:"midtrans"`
|
||||
Brevo Brevo `mapstructure:"brevo"`
|
||||
Email Email `mapstructure:"email"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -67,5 +69,9 @@ func (c *Config) Auth() *AuthConfig {
|
||||
jwtTokenExpiresTTL: c.Jwt.Token.ExpiresTTL,
|
||||
jwtOrderSecret: c.Jwt.TokenOrder.Secret,
|
||||
jwtOrderExpiresTTL: c.Jwt.TokenOrder.ExpiresTTL,
|
||||
jwtSecretResetPassword: JWT{
|
||||
secret: c.Jwt.TokenResetPassword.Secret,
|
||||
expireTTL: c.Jwt.TokenResetPassword.ExpiresTTL,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+19
-4
@@ -3,10 +3,16 @@ package config
|
||||
import "time"
|
||||
|
||||
type AuthConfig struct {
|
||||
jwtTokenExpiresTTL int
|
||||
jwtTokenSecret string
|
||||
jwtOrderSecret string
|
||||
jwtOrderExpiresTTL int
|
||||
jwtTokenExpiresTTL int
|
||||
jwtTokenSecret string
|
||||
jwtOrderSecret string
|
||||
jwtOrderExpiresTTL int
|
||||
jwtSecretResetPassword JWT
|
||||
}
|
||||
|
||||
type JWT struct {
|
||||
secret string
|
||||
expireTTL int
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenSecret() string {
|
||||
@@ -26,3 +32,12 @@ func (c *AuthConfig) AccessTokenExpiresDate() time.Time {
|
||||
duration := time.Duration(c.jwtTokenExpiresTTL)
|
||||
return time.Now().UTC().Add(time.Minute * duration)
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenResetPasswordSecret() string {
|
||||
return c.jwtSecretResetPassword.secret
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenResetPasswordExpire() time.Time {
|
||||
duration := time.Duration(c.jwtSecretResetPassword.expireTTL)
|
||||
return time.Now().UTC().Add(time.Minute * duration)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package config
|
||||
|
||||
type Email struct {
|
||||
Sender string `mapstructure:"sender"`
|
||||
CustomReceiver string `mapstructure:"custom_receiver"`
|
||||
ResetPassword EmailConfig `mapstructure:"reset_password"`
|
||||
}
|
||||
|
||||
type EmailConfig struct {
|
||||
Subject string `mapstructure:"subject"`
|
||||
OpeningWord string `mapstructure:"opening_word"`
|
||||
Link string `mapstructure:"link"`
|
||||
Notes string `mapstructure:"note"`
|
||||
ClosingWord string `mapstructure:"closing_word"`
|
||||
TemplateName string `mapstructure:"template_name"`
|
||||
TemplatePath string `mapstructure:"template_path"`
|
||||
}
|
||||
|
||||
type EmailMemberRequestActionConfig struct {
|
||||
TemplateName string `mapstructure:"template_name"`
|
||||
TemplatePath string `mapstructure:"template_path"`
|
||||
Subject string `mapstructure:"subject"`
|
||||
Content string `mapstructure:"content"`
|
||||
}
|
||||
|
||||
func (e *Email) GetSender() string {
|
||||
return e.Sender
|
||||
}
|
||||
|
||||
func (e *Email) GetCustomReceiver() string {
|
||||
return e.CustomReceiver
|
||||
}
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
package config
|
||||
|
||||
type Jwt struct {
|
||||
Token Token `mapstructure:"token"`
|
||||
TokenOrder Token `mapstructure:"token-order"`
|
||||
Token Token `mapstructure:"token"`
|
||||
TokenOrder Token `mapstructure:"token-order"`
|
||||
TokenResetPassword Token `mapstructure:"token-reset-password"`
|
||||
}
|
||||
|
||||
type Token struct {
|
||||
|
||||
Reference in New Issue
Block a user