File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 38
38
flagSendgridApiKey string
39
39
flagEmailFrom string
40
40
flagEmailFromName string = "WireGuard UI"
41
- flagSessionSecret string
41
+ flagSessionSecret string = util . RandomString ( 32 )
42
42
flagWgConfTemplate string
43
43
flagBasePath string
44
44
)
Original file line number Diff line number Diff line change 9
9
"io"
10
10
"io/fs"
11
11
"io/ioutil"
12
+ "math/rand"
12
13
"net"
13
14
"os"
14
15
"path"
@@ -529,3 +530,13 @@ func UpdateHashes(db store.IStore) error {
529
530
clientServerHashes .Client , clientServerHashes .Server = GetCurrentHash (db )
530
531
return db .SaveHashes (clientServerHashes )
531
532
}
533
+
534
+ func RandomString (length int ) string {
535
+ var seededRand = rand .New (rand .NewSource (time .Now ().UnixNano ()))
536
+ charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
537
+ b := make ([]byte , length )
538
+ for i := range b {
539
+ b [i ] = charset [seededRand .Intn (len (charset ))]
540
+ }
541
+ return string (b )
542
+ }
You can’t perform that action at this time.
0 commit comments