...
|
...
|
@@ -158,7 +158,7 @@ func DeleteUserAuth(id int) (err error) { |
|
|
|
|
|
func GetUserByAuthCode(authCode string) (v *UserAuth, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := "select * from user_auth where auth_code=? and auth_exp >= Now()"
|
|
|
sql := "select * from user_auth where auth_code=? and auth_code_exp >= Now()"
|
|
|
if err = o.Raw(sql, authCode).QueryRow(&v); err == nil {
|
|
|
return v, nil
|
|
|
}
|
...
|
...
|
@@ -167,7 +167,7 @@ func GetUserByAuthCode(authCode string) (v *UserAuth, err error) { |
|
|
|
|
|
func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := "select * from user_auth where refresh_token=? and auth_exp >= Now()" // TODO: and enabled = 1
|
|
|
sql := "select * from user_auth where refresh_token=? and refresh_token_exp >= Now()" // TODO: and enabled = 1
|
|
|
if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil {
|
|
|
return v, nil
|
|
|
}
|
...
|
...
|
@@ -176,7 +176,7 @@ func GetUserAuthByRefreshToken(refreshToken string) (v *UserAuth, err error) { |
|
|
|
|
|
func GetUserAuthByToken(refreshToken string) (v *UserAuth, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := "select * from user_auth where refresh_token=? and auth_exp >= Now()" // TODO: and enabled = 1
|
|
|
sql := "select * from user_auth where access_token=? and access_token_exp >= Now()" // TODO: and enabled = 1
|
|
|
if err = o.Raw(sql, refreshToken).QueryRow(&v); err == nil {
|
|
|
return v, nil
|
|
|
}
|
...
|
...
|
|