summaryrefslogtreecommitdiffstats
path: root/models/token.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-19 06:22:33 +0800
committerUnknwon <u@gogs.io>2015-08-19 06:22:33 +0800
commit03b85b73af03eae98308fc3d36cdbd47db1503d6 (patch)
tree686f7e0c63c274c168718ee8d06b1431a8e8ed44 /models/token.go
parent54b52de6eed4eb2f76620c48189ba3167c290121 (diff)
downloadgitea-03b85b73af03eae98308fc3d36cdbd47db1503d6.tar.gz
gitea-03b85b73af03eae98308fc3d36cdbd47db1503d6.zip
token recent activity
Diffstat (limited to 'models/token.go')
-rw-r--r--models/token.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/models/token.go b/models/token.go
index a95c453352..6c4328e53e 100644
--- a/models/token.go
+++ b/models/token.go
@@ -35,8 +35,8 @@ func NewAccessToken(t *AccessToken) error {
return err
}
-// GetAccessTokenBySha returns access token by given sha1.
-func GetAccessTokenBySha(sha string) (*AccessToken, error) {
+// GetAccessTokenBySHA returns access token by given sha1.
+func GetAccessTokenBySHA(sha string) (*AccessToken, error) {
t := &AccessToken{Sha1: sha}
has, err := x.Get(t)
if err != nil {
@@ -62,6 +62,12 @@ func ListAccessTokens(uid int64) ([]*AccessToken, error) {
return tokens, nil
}
+// UpdateAccessToekn updates information of access token.
+func UpdateAccessToekn(t *AccessToken) error {
+ _, err := x.Id(t.ID).AllCols().Update(t)
+ return err
+}
+
// DeleteAccessTokenByID deletes access token by given ID.
func DeleteAccessTokenByID(id int64) error {
_, err := x.Id(id).Delete(new(AccessToken))