package scsusers import ( "fmt" "log" "time" ) func RecoverByEmail(email string) { u, ok := Get(email) if !ok { return } log.Printf("%#v", u) recoverycode := generatePassword(16) u.Delete("recoverycode") u.Delete("recoverytime") u.Set("recoverycode", string(recoverycode)) u.Set("recoverytime", fmt.Sprintf("%d", time.Now().Add(time.Minute*60).Unix())) SendRecoveryEmail(email, email, string(recoverycode)) }