mirror of
https://github.com/gogs/gogs.git
synced 2025-12-23 16:50:02 +01:00
access_token: encrypt access token with SHA256 (#7008)
* access_token: encrypt access token with SHA256 * revert list access token * fix lint * generate schemadoc * add database migrations * fix tests * fix tests * add test case for access token golden * fix test in postgres * `Sha256` -> `SHA256` * Use GORM for migration * task generate-schemadoc * Use unique * change migration name * allow read * task generate-schemadoc * add changelog * fix lint error * update changelog * remove Debug * add comments Co-authored-by: Joe Chen <jc@unknwon.io>
This commit is contained in:
@@ -130,7 +130,7 @@ func authenticatedUserID(c *macaron.Context, sess session.Store) (_ int64, isTok
|
||||
|
||||
// Let's see if token is valid.
|
||||
if len(tokenSHA) > 0 {
|
||||
t, err := db.AccessTokens.GetBySHA(tokenSHA)
|
||||
t, err := db.AccessTokens.GetBySHA1(tokenSHA)
|
||||
if err != nil {
|
||||
if !db.IsErrAccessTokenNotExist(err) {
|
||||
log.Error("GetAccessTokenBySHA: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user