Add login

This commit is contained in:
2020-01-05 23:20:38 +01:00
parent dc396a300f
commit c0926ffea0
35 changed files with 1647 additions and 39 deletions

24
utils/rand.go Normal file
View File

@@ -0,0 +1,24 @@
package utils
import (
"math/rand"
"time"
)
const charset = "abcdefghijklmnopqrstuvwxyz" +
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
var seededRand = rand.New(
rand.NewSource(time.Now().UnixNano()))
func StringWithCharset(length int, charset string) string {
b := make([]byte, length)
for i := range b {
b[i] = charset[seededRand.Intn(len(charset))]
}
return string(b)
}
func String(length int) string {
return StringWithCharset(length, charset)
}