|
|
@ -7,7 +7,7 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func AddAccountRecord(uuid []byte, username string, key, salt []byte) error {
|
|
|
|
func AddAccountRecord(uuid []byte, username string, key, salt []byte) error {
|
|
|
|
_, err := handle.Exec("INSERT INTO accounts (uuid, username, [key], salt, registered) VALUES (?, ?, ?, ?, UTC_TIMESTAMP())", uuid, username, key, salt)
|
|
|
|
_, err := handle.Exec("INSERT INTO accounts (uuid, username, hash, salt, registered) VALUES (?, ?, ?, ?, UTC_TIMESTAMP())", uuid, username, key, salt)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -40,7 +40,7 @@ func GetUsernameFromToken(token []byte) (string, error) {
|
|
|
|
|
|
|
|
|
|
|
|
func GetAccountKeySaltFromUsername(username string) ([]byte, []byte, error) {
|
|
|
|
func GetAccountKeySaltFromUsername(username string) ([]byte, []byte, error) {
|
|
|
|
var key, salt []byte
|
|
|
|
var key, salt []byte
|
|
|
|
err := handle.QueryRow("SELECT a.key, a.salt FROM accounts a WHERE a.username = ?", username).Scan(&key, &salt)
|
|
|
|
err := handle.QueryRow("SELECT hash, salt FROM accounts WHERE username = ?", username).Scan(&key, &salt)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|