mirror of https://github.com/1Panel-dev/1Panel
feat: 1pctl 支持 mfa、ssl 和安全入口关闭 (#818)
parent
c5e8a3fa04
commit
0ebd04f012
@ -0,0 +1,49 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(resetMFACmd)
|
||||
RootCmd.AddCommand(resetSSLCmd)
|
||||
RootCmd.AddCommand(resetEntranceCmd)
|
||||
}
|
||||
|
||||
var resetMFACmd = &cobra.Command{
|
||||
Use: "reset-mfa",
|
||||
Short: "关闭 1Panel 两步验证",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
db, err := loadDBConn()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return setSettingByKey(db, "MFAStatus", "disable")
|
||||
},
|
||||
}
|
||||
|
||||
var resetSSLCmd = &cobra.Command{
|
||||
Use: "reset-ssl",
|
||||
Short: "取消 1Panel https 方式登录",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
db, err := loadDBConn()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return setSettingByKey(db, "SSL", "disable")
|
||||
},
|
||||
}
|
||||
var resetEntranceCmd = &cobra.Command{
|
||||
Use: "reset-entrance",
|
||||
Short: "取消 1Panel 安全入口",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
db, err := loadDBConn()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return setSettingByKey(db, "SecurityEntranceStatus", "disable")
|
||||
},
|
||||
}
|
Loading…
Reference in new issue