diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-26 08:58:34 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-26 08:58:34 (GMT) |
commit | e2dee26e41817302ed4e14207ce779d58004f797 (patch) | |
tree | 1c472734f4bac38856d070a45ae979101af1c6d2 /fetcher.go | |
parent | 7f63f817486684c0dcb440bf57ff79c07c487911 (diff) |
session store now checks password
Diffstat (limited to 'fetcher.go')
-rw-r--r-- | fetcher.go | 31 |
1 files changed, 7 insertions, 24 deletions
@@ -247,31 +247,14 @@ func fetcher_init() { } func checkPassword(ctx *ImportContext, result *FetchResult) (err error) { - cached := true - - for { - res_ch := make(chan getPasswordResult) - req := getPasswordRequest{} - req.username = ctx.UserName - req.cached = cached - req.response = res_ch - ctx.rddb.getPasswordChan <- req - - res := <-res_ch - if res.err != nil { - return res.err - } - if ctx.Password == res.password { - return nil - } - if cached { - cached = false - } else { - break - } + ok := false + if ok, err = ctx.rddb.CheckPassword(ctx.UserName, ctx.Password); err != nil { + return + } + if !ok { + result.ResponseCode = http.StatusUnauthorized + result.ErrorString = "invalid username and/or password" } - result.ResponseCode = http.StatusUnauthorized - result.ErrorString = "invalid username and/or password" return } |