mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 13:29:52 +09:00
Remove error returns from crypto random helpers and callers (#37240)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
This commit is contained in:
co-authored by
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
wxiaoguang
wxiaoguang
silverwind
parent
82bfde2a37
commit
4a2bba9aed
@@ -51,10 +51,7 @@ func AddScratchHash(x *xorm.Engine) error {
|
||||
|
||||
for _, tfa := range tfas {
|
||||
// generate salt
|
||||
salt, err := util.CryptoRandomString(10)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
salt := util.CryptoRandomString(10)
|
||||
tfa.ScratchSalt = salt
|
||||
tfa.ScratchHash = base.HashToken(tfa.ScratchToken, salt)
|
||||
|
||||
|
||||
@@ -65,10 +65,7 @@ func HashAppToken(x *xorm.Engine) error {
|
||||
|
||||
for _, token := range tokens {
|
||||
// generate salt
|
||||
salt, err := util.CryptoRandomString(10)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
salt := util.CryptoRandomString(10)
|
||||
token.TokenSalt = salt
|
||||
token.TokenHash = base.HashToken(token.Sha1, salt)
|
||||
if len(token.Sha1) < 8 {
|
||||
|
||||
Reference in New Issue
Block a user