register return error instead of bool
This commit is contained in:
parent
0cb02fb65f
commit
e9c29afd67
4
main.go
4
main.go
|
@ -94,7 +94,7 @@ func Register(username, email, ip string) error {
|
||||||
_, err = c.db.Query(fmt.Sprintf("insert into %s_users (username, password) VALUES (?,?)", c.TablePrefix), username, crypt)
|
_, err = c.db.Query(fmt.Sprintf("insert into %s_users (username, password) VALUES (?,?)", c.TablePrefix), username, crypt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
|
log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
|
||||||
return fmt.Errorf("Failed to insert user")
|
return fmt.Errorf("failed to insert user")
|
||||||
}
|
}
|
||||||
|
|
||||||
if SendRegistrationEmail(email, username, string(pass)) {
|
if SendRegistrationEmail(email, username, string(pass)) {
|
||||||
|
@ -107,7 +107,7 @@ func Register(username, email, ip string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("scsusers.Register: Failed to delete new user %s: %s\n", username, err.Error())
|
log.Printf("scsusers.Register: Failed to delete new user %s: %s\n", username, err.Error())
|
||||||
}
|
}
|
||||||
return fmt.Errorf("Failed to send registration email")
|
return fmt.Errorf("failed to send registration email")
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUser() *UserData {
|
func NewUser() *UserData {
|
||||||
|
|
Loading…
Reference in New Issue