feat: user jwt login

This commit is contained in:
Noah Hsu
2022-06-25 21:34:44 +08:00
parent 306b90399c
commit c5295f4d72
16 changed files with 269 additions and 21 deletions

View File

@ -0,0 +1,23 @@
package random
import (
"math/rand"
"time"
)
var Rand *rand.Rand
const letterBytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
func RandomStr(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[Rand.Intn(len(letterBytes))]
}
return string(b)
}
func init() {
s := rand.NewSource(time.Now().UnixNano())
Rand = rand.New(s)
}