Commit 03594f23 authored by Eric's avatar Eric

[update] add manual login server

parent d77a0dda
......@@ -28,14 +28,30 @@ func (p *ProxyServer) getSystemUserAuthOrManualSet() {
if p.SystemUser.LoginMode == model.LoginModeManual ||
(p.SystemUser.Password == "" && p.SystemUser.PrivateKey == "") {
// Todo: terminal
logger.Info("Get password fom user input")
term := utils.NewTerminal(p.UserConn, "password: ")
line, err := term.ReadPassword("password")
if err != nil {
logger.Errorf("Get password from user err %s", err.Error())
}
logger.Info("Get password fom user input: ", line)
p.SystemUser.Password = line
}
}
func (p *ProxyServer) getSystemUserUsernameIfNeed() {
// Todo: terminal
if p.SystemUser.Username == "" {
var username string
term := utils.NewTerminal(p.UserConn, "username: ")
for {
username, _ = term.ReadLine()
username = strings.TrimSpace(username)
if username != "" {
break
}
}
p.SystemUser.Username = username
logger.Info("Get username from user input: ", username)
}
}
func (p *ProxyServer) checkProtocolMatch() bool {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment