-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package trojan | ||
|
||
import ( | ||
"crypto/sha256" | ||
"fmt" | ||
"trojan/core" | ||
"trojan/util" | ||
) | ||
|
||
// WebMenu web管理菜单 | ||
func WebMenu() { | ||
fmt.Println() | ||
menu := []string{"重置web管理员密码"} | ||
switch util.LoopInput("请选择: ", menu, true) { | ||
case 1: | ||
ResetAdminPass() | ||
} | ||
} | ||
|
||
// ResetAdminPass 重置管理员密码 | ||
func ResetAdminPass() { | ||
inputPass := util.Input("请输入admin用户密码: ", "") | ||
if inputPass == "" { | ||
fmt.Println("撤销更改!") | ||
} else { | ||
encryPass := sha256.Sum224([]byte(inputPass)) | ||
err := core.SetValue("admin_pass", fmt.Sprintf("%x", encryPass)) | ||
if err == nil { | ||
fmt.Println(util.Green("重置admin密码成功!")) | ||
} else { | ||
fmt.Println(err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters