Add phone registration with SMS verification and regenerate Swagger docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,12 +21,20 @@ func DoWithTries(fn func() error, attempts int, delay time.Duration) error {
|
||||
}
|
||||
|
||||
func GenerateTokenPair(id int) (map[string]string, error) {
|
||||
return generateTokenPair(id, true)
|
||||
}
|
||||
|
||||
func GenerateUserTokenPair(id int) (map[string]string, error) {
|
||||
return generateTokenPair(id, false)
|
||||
}
|
||||
|
||||
func generateTokenPair(id int, admin bool) (map[string]string, error) {
|
||||
cfg := config.GetConfig()
|
||||
secret := []byte(cfg.JwtKey)
|
||||
|
||||
accessToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
"id": id,
|
||||
"admin": true,
|
||||
"admin": admin,
|
||||
"exp": time.Now().Add(time.Hour).Unix(),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user