You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
701 B
25 lines
701 B
package cache
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
"recook/internal/dbc"
|
|
"time"
|
|
)
|
|
|
|
const SuperKey = "SuperPassword"
|
|
const ExpirationTime = 5 * time.Minute
|
|
|
|
func SetSuperPassword() {
|
|
// 生成四位验证码,放入缓存
|
|
pwd := fmt.Sprintf("%05v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000))
|
|
pwd = pwd[1:]
|
|
|
|
// 本来为了安全设置的上面的随机生成的密码
|
|
// 后来产品说要永久有效,那就 直接写死吧, 源代码保留,
|
|
// todo 如果要考虑安全因素,建议改回去, 然后用企点qq发送最新的密码通知
|
|
pwd = "0716"
|
|
dbc.Rds.Set(SuperKey, pwd, ExpirationTime).Result()
|
|
// fmt.Println("当前设置的超级密码为:[", pwd, "]")
|
|
}
|