mirror of
https://github.com/pushbits/server.git
synced 2025-05-04 04:36:28 +02:00
fix revive reported issues
This commit is contained in:
parent
8bdd7166b8
commit
05916239c7
3 changed files with 6 additions and 6 deletions
|
@ -61,7 +61,7 @@ func (a *Authenticator) requireUserProperty(has hasUserProperty) gin.HandlerFunc
|
||||||
|
|
||||||
// RequireUser returns a Gin middleware which requires valid user credentials to be supplied with the request.
|
// RequireUser returns a Gin middleware which requires valid user credentials to be supplied with the request.
|
||||||
func (a *Authenticator) RequireUser() gin.HandlerFunc {
|
func (a *Authenticator) RequireUser() gin.HandlerFunc {
|
||||||
return a.requireUserProperty(func(user *model.User) bool {
|
return a.requireUserProperty(func(_ *model.User) bool {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,9 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func randIntn(n int) int {
|
func randIntn(n int) int {
|
||||||
max := big.NewInt(int64(n))
|
maxValue := big.NewInt(int64(n))
|
||||||
|
|
||||||
res, err := rand.Int(rand.Reader, max)
|
res, err := rand.Int(rand.Reader, maxValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("random source is not available")
|
panic("random source is not available")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
)
|
)
|
||||||
|
|
||||||
func randStr(len int) string {
|
func randStr(length int) string {
|
||||||
buff := make([]byte, len)
|
buff := make([]byte, length)
|
||||||
|
|
||||||
_, err := rand.Read(buff)
|
_, err := rand.Read(buff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,5 +16,5 @@ func randStr(len int) string {
|
||||||
str := base64.StdEncoding.EncodeToString(buff)
|
str := base64.StdEncoding.EncodeToString(buff)
|
||||||
|
|
||||||
// Base 64 can be longer than len
|
// Base 64 can be longer than len
|
||||||
return str[:len]
|
return str[:length]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue