add support for sending emails

Change-Id: I9749cda3b997d70271cb4ca709a7cca82a9a0948
This commit is contained in:
dm
2016-06-10 12:57:41 -07:00
committed by sm
parent 227eb4a551
commit 480304bd87
6 changed files with 370 additions and 34 deletions
+16
View File
@@ -319,3 +319,19 @@ func (db *DB) addUser(email string) (string, error) {
)
return tok, err
}
func (db *DB) user(email string) (User, error) {
u := User{}
err := db.conn.Get(
&u,
"SELECT email, token, registered, requested FROM users WHERE email = ?",
email,
)
if err == sql.ErrNoRows {
return User{}, verrors.HTTP{
Message: fmt.Sprintf("could not find requested user's email: %q: %v", email, err),
Code: http.StatusNotFound,
}
}
return u, err
}