add app
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -28,6 +29,18 @@ func init() {
|
||||
uncommonInitialismsReplacer = strings.NewReplacer(uncommonInitialismsForReplacer...)
|
||||
}
|
||||
|
||||
var (
|
||||
letterBytes = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
)
|
||||
|
||||
func RandStringBytes(n int) string {
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func Captcha(c *gin.Context, length ...int) {
|
||||
l := captcha.DefaultLen
|
||||
w, h := 107, 36
|
||||
|
||||
Reference in New Issue
Block a user