aboutsummaryrefslogtreecommitdiffstats
path: root/apiv1.go
diff options
context:
space:
mode:
Diffstat (limited to 'apiv1.go')
-rw-r--r--apiv1.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/apiv1.go b/apiv1.go
index 892c06b..592e7de 100644
--- a/apiv1.go
+++ b/apiv1.go
@@ -36,14 +36,14 @@ func (app *App) mainHandler(w http.ResponseWriter, r *http.Request) {
user := r.FormValue("u")
auth := r.FormValue("a")
- password, err := app.GetPassword(user)
+ userId, password, err := app.GetUser(user)
if (md5hex(password+timestamp) != auth) || err != nil {
fmt.Fprintln(w, "BADAUTH")
return
}
s := &Session{
- User: user,
+ UserId: userId,
Client: r.FormValue("c"),
ClientVersion: r.FormValue("v"),
Key: randomToken(16),
@@ -162,6 +162,7 @@ func parseScrobbles(values url.Values, session *Session) ([]Scrobble, int) {
ignored++
} else {
scrobble.Session = session.Key
+ scrobble.UserId = session.UserId
scrobbles = append(scrobbles, scrobble)
}
}