(x *xorm.Engine)
| 68 | } |
| 69 | |
| 70 | func defaultLoginConfig(x *xorm.Engine) (err error) { |
| 71 | fmt.Println("set default login config") |
| 72 | |
| 73 | loginSiteInfo := &entity.SiteInfo{ |
| 74 | Type: constant.SiteTypeLogin, |
| 75 | } |
| 76 | exist, err := x.Get(loginSiteInfo) |
| 77 | if err != nil { |
| 78 | return fmt.Errorf("get config failed: %w", err) |
| 79 | } |
| 80 | if exist { |
| 81 | var content map[string]any |
| 82 | _ = json.Unmarshal([]byte(loginSiteInfo.Content), &content) |
| 83 | content["allow_password_login"] = true |
| 84 | dataByte, _ := json.Marshal(content) |
| 85 | loginSiteInfo.Content = string(dataByte) |
| 86 | _, err = x.ID(loginSiteInfo.ID).Cols("content").Update(loginSiteInfo) |
| 87 | if err != nil { |
| 88 | return fmt.Errorf("update site info failed: %w", err) |
| 89 | } |
| 90 | } |
| 91 | return nil |
| 92 | } |
| 93 | |
| 94 | func deactivatePlugin(x *xorm.Engine, pluginSlugName string) (err error) { |
| 95 | fmt.Printf("try to deactivate plugin: %s\n", pluginSlugName) |
no test coverage detected