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 | 62ebc38acc54335ed7c4b14551fae828efddc333 (patch) | |
tree | 4a903c7aa8ca6bd201f3d094067378a9436473f8 /src/helsinki.at/rhimport/rddb.go | |
parent | f85d82026efe9272782eaebc36c822798a5525db (diff) |
session store now checks password
Diffstat (limited to 'src/helsinki.at/rhimport/rddb.go')
-rw-r--r-- | src/helsinki.at/rhimport/rddb.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimport/rddb.go b/src/helsinki.at/rhimport/rddb.go index 514abdf..7466d9c 100644 --- a/src/helsinki.at/rhimport/rddb.go +++ b/src/helsinki.at/rhimport/rddb.go @@ -177,6 +177,33 @@ func (self *RdDb) getPassword(username string, cached bool) (result getPasswordR return } +func (self *RdDbChan) CheckPassword(username, password string) (result bool, err error) { + cached := true + + for { + res_ch := make(chan getPasswordResult) + req := getPasswordRequest{} + req.username = username + req.cached = cached + req.response = res_ch + self.getPasswordChan <- req + + res := <-res_ch + if res.err != nil { + return false, res.err + } + if password == res.password { + return true, nil + } + if cached { + cached = false + } else { + break + } + } + return false, nil +} + func (self *RdDb) getGroupOfCart(cart uint) (result getGroupOfCartResult) { var rows *sql.Rows if rows, result.err = self.getGroupOfCartStmt.Query(cart, cart); result.err != nil { |