Skeleton files and http
This commit is contained in:
@@ -1,2 +1,19 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type Password struct {
|
||||
password sql.NullString
|
||||
}
|
||||
|
||||
func Verify(db *sql.DB, username string, password string) (bool, error) {
|
||||
row := db.QueryRow("SELECT password FROM users WHERE username = ?;", username)
|
||||
dbPassword := &Password{}
|
||||
err := row.Scan(&dbPassword.password)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return (dbPassword.password.String == password), nil
|
||||
}
|
||||
Reference in New Issue
Block a user