Skip to content

Commit

Permalink
update default admin
Browse files Browse the repository at this point in the history
  • Loading branch information
usual2970 committed Aug 26, 2024
1 parent 4a03f93 commit c820fee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Certimate 旨在为用户提供一个安全、简便的 SSL 证书管理解决
默认账号:

```bash
用户名:admin@essay.com
用户名:admin@certimate.fun
密码:1234567890
```

Expand Down
29 changes: 29 additions & 0 deletions migrations/1724677539_update_admin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package migrations

import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/models"
)

func init() {
m.Register(func(db dbx.Builder) error {
// add up queries...
dao := daos.New(db)

admin := &models.Admin{}
admin.Email = "[email protected]"
admin.SetPassword("1234567890")
return dao.SaveAdmin(admin)
}, func(db dbx.Builder) error {
// add down queries...
dao := daos.New(db)

admin, _ := dao.FindAdminByEmail("[email protected]")
if admin != nil {
return dao.DeleteAdmin(admin)
}
return nil
})
}

0 comments on commit c820fee

Please sign in to comment.