mirror of https://github.com/1Panel-dev/1Panel
ssongliu
2 years ago
committed by
GitHub
4 changed files with 86 additions and 44 deletions
@ -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