From 06b7d3e8a6b8363d5cfcfbd19ea7365ff6fab543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxi=20Quo=C3=9F?= Date: Mon, 10 Jul 2023 16:11:34 +0200 Subject: [PATCH] lower minimum user password length to 5, #112 --- .../migrations/1688998224_updated_users.go | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 backend/migrations/1688998224_updated_users.go diff --git a/backend/migrations/1688998224_updated_users.go b/backend/migrations/1688998224_updated_users.go new file mode 100644 index 00000000..64e8d5e0 --- /dev/null +++ b/backend/migrations/1688998224_updated_users.go @@ -0,0 +1,57 @@ +package migrations + +import ( + "encoding/json" + + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/daos" + m "github.com/pocketbase/pocketbase/migrations" +) + +func init() { + m.Register(func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("27do0wbcuyfmbmx") + if err != nil { + return err + } + + options := map[string]any{} + json.Unmarshal([]byte(`{ + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": [], + "manageRule": null, + "minPasswordLength": 5, + "onlyEmailDomains": [], + "requireEmail": false + }`), &options) + collection.SetOptions(options) + + return dao.SaveCollection(collection) + }, func(db dbx.Builder) error { + dao := daos.New(db); + + collection, err := dao.FindCollectionByNameOrId("27do0wbcuyfmbmx") + if err != nil { + return err + } + + options := map[string]any{} + json.Unmarshal([]byte(`{ + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": [], + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": [], + "requireEmail": false + }`), &options) + collection.SetOptions(options) + + return dao.SaveCollection(collection) + }) +}