aboutsummaryrefslogtreecommitdiffstats
path: root/apiv1.go
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2017-06-06 19:20:09 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2017-06-06 19:20:09 -0400
commit53841da448baa28067bab046198757954cebc4a1 (patch)
tree514750df12d2391b77d55b124a8a044b0d4998b1 /apiv1.go
parent81522cbae16c6aadb1b789f3f875dc50f10cc005 (diff)
downloadlastfm-api-53841da448baa28067bab046198757954cebc4a1.tar.gz
Use user_id instead of lfm_name as much as possible
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)
}
}