summaryrefslogtreecommitdiffstats
path: root/routers/user/oauth.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-15 22:46:21 +0800
committerGitHub <noreply@github.com>2019-08-15 22:46:21 +0800
commit85202d4784758573f80f93dbbda97a444e7ece99 (patch)
tree7957506de8657463e79f121e1b79567ef1cc84a1 /routers/user/oauth.go
parent5a44be627c055d3e9eb406ec4a91579de78b6910 (diff)
downloadgitea-85202d4784758573f80f93dbbda97a444e7ece99.tar.gz
gitea-85202d4784758573f80f93dbbda97a444e7ece99.zip
Display ui time with customize time location (#7792)
* display ui time with customize time location * fix lint * rename UILocation to DefaultUILocation * move time related functions to modules/timeutil * fix tests * fix tests * fix build * fix swagger
Diffstat (limited to 'routers/user/oauth.go')
-rw-r--r--routers/user/oauth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/user/oauth.go b/routers/user/oauth.go
index 924bac8ef6..19add5e647 100644
--- a/routers/user/oauth.go
+++ b/routers/user/oauth.go
@@ -7,7 +7,6 @@ package user
import (
"encoding/base64"
"fmt"
- "github.com/go-macaron/binding"
"net/url"
"strings"
@@ -17,9 +16,10 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
- "code.gitea.io/gitea/modules/util"
+ "code.gitea.io/gitea/modules/timeutil"
"github.com/dgrijalva/jwt-go"
+ "github.com/go-macaron/binding"
)
const (
@@ -118,7 +118,7 @@ func newAccessTokenResponse(grant *models.OAuth2Grant) (*AccessTokenResponse, *A
}
}
// generate access token to access the API
- expirationDate := util.TimeStampNow().Add(setting.OAuth2.AccessTokenExpirationTime)
+ expirationDate := timeutil.TimeStampNow().Add(setting.OAuth2.AccessTokenExpirationTime)
accessToken := &models.OAuth2Token{
GrantID: grant.ID,
Type: models.TypeAccessToken,
@@ -135,7 +135,7 @@ func newAccessTokenResponse(grant *models.OAuth2Grant) (*AccessTokenResponse, *A
}
// generate refresh token to request an access token after it expired later
- refreshExpirationDate := util.TimeStampNow().Add(setting.OAuth2.RefreshTokenExpirationTime * 60 * 60).AsTime().Unix()
+ refreshExpirationDate := timeutil.TimeStampNow().Add(setting.OAuth2.RefreshTokenExpirationTime * 60 * 60).AsTime().Unix()
refreshToken := &models.OAuth2Token{
GrantID: grant.ID,
Counter: grant.Counter,