diff options
author | enahum <nahumhbl@gmail.com> | 2017-04-03 14:37:58 -0300 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-04-03 10:37:58 -0700 |
commit | 1cbe6e797517089140ee2db12d73c0781f5e3e6b (patch) | |
tree | 5671819dcbfdc6f359410e3558135090d3724e4c /store/sql_oauth_store.go | |
parent | 68bb5a2ec85a6d34726a137bad65157d0ff65247 (diff) | |
download | chat-1cbe6e797517089140ee2db12d73c0781f5e3e6b.tar.gz chat-1cbe6e797517089140ee2db12d73c0781f5e3e6b.tar.bz2 chat-1cbe6e797517089140ee2db12d73c0781f5e3e6b.zip |
Add more OAuth unit tests (#5946)
Diffstat (limited to 'store/sql_oauth_store.go')
-rw-r--r-- | store/sql_oauth_store.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/store/sql_oauth_store.go b/store/sql_oauth_store.go index caa04c008..72bc574d9 100644 --- a/store/sql_oauth_store.go +++ b/store/sql_oauth_store.go @@ -387,6 +387,12 @@ func (as SqlOAuthStore) UpdateAccessData(accessData *model.AccessData) StoreChan go func() { result := StoreResult{} + if result.Err = accessData.IsValid(); result.Err != nil { + storeChannel <- result + close(storeChannel) + return + } + if _, err := as.GetMaster().Exec("UPDATE OAuthAccessData SET Token = :Token, ExpiresAt = :ExpiresAt WHERE ClientId = :ClientId AND UserID = :UserId", map[string]interface{}{"Token": accessData.Token, "ExpiresAt": accessData.ExpiresAt, "ClientId": accessData.ClientId, "UserId": accessData.UserId}); err != nil { result.Err = model.NewLocAppError("SqlOAuthStore.Update", "store.sql_oauth.update_access_data.app_error", nil, |