more
This commit is contained in:
parent
6625ab0216
commit
376afee183
11
main.go
11
main.go
|
@ -9,6 +9,7 @@ import (
|
|||
"html/template"
|
||||
"log"
|
||||
"crypto/rand"
|
||||
"encoding/base32"
|
||||
"net/smtp"
|
||||
"strings"
|
||||
)
|
||||
|
@ -144,12 +145,12 @@ func RecoverByEmail(e string) {
|
|||
|
||||
|
||||
func randBytes(n int) []byte {
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Int(len(letterBytes))]
|
||||
randomBytes := make([]byte, 32)
|
||||
_, err := rand.Read(randomBytes)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return b
|
||||
return []byte(base32.StdEncoding.EncodeToString(randomBytes)[:n])
|
||||
}
|
||||
|
||||
func sendRegistrationEmail(recipient, username, password string) bool {
|
||||
|
|
Loading…
Reference in New Issue