feat: 迁移游戏商务绑定审核流程和列表
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package gameplatform
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLegacyPasswordFormats(t *testing.T) {
|
||||
p := &Passwords{AuthCode: "test-auth", MigrateAuthCode: "test-migrate", TablePrefix: "sys_"}
|
||||
// 固定向量由独立的 Python hashlib 按原 Java 算法生成。
|
||||
for _, hash := range []string{"###eef6d9b7160f32a869f3e03b7ea575a5", "9db2515d8fcc62cc2d8b4bf2d8728120d052163a77df7f09", "##$##073cf9a979400c63c0dc69f201efcdf8"} {
|
||||
if ok, err := p.Verify("demo123", hash); err != nil || !ok {
|
||||
t.Fatalf("旧密码格式不兼容: %v", err)
|
||||
}
|
||||
if ok, _ := p.Verify("wrong", hash); ok {
|
||||
t.Fatal("错误密码被接受")
|
||||
}
|
||||
}
|
||||
if ok, err := (&Passwords{}).Verify("demo123", "###eef6d9b7160f32a869f3e03b7ea575a5"); ok || err == nil {
|
||||
t.Fatal("缺少兼容盐时必须明确报错")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user