Commit e3643641 authored by szh's avatar szh

password

parent 010adfb4
...@@ -460,7 +460,10 @@ func FeedBackStatus(c *gin.Context){ ...@@ -460,7 +460,10 @@ func FeedBackStatus(c *gin.Context){
} }
func EscrowPasswd(c *gin.Context){ func EscrowPasswd(c *gin.Context){
var passwd map[string]string type Password struct {
Password string `json:"password" binding:"required"`
}
var passwd Password
appG:=app.Gin{C:c} appG:=app.Gin{C:c}
err:=appG.C.ShouldBindJSON(&passwd) err:=appG.C.ShouldBindJSON(&passwd)
if err!=nil{ if err!=nil{
...@@ -470,7 +473,7 @@ func EscrowPasswd(c *gin.Context){ ...@@ -470,7 +473,7 @@ func EscrowPasswd(c *gin.Context){
} }
r,errs:=setting.PaiClient.Unlock(&types.WalletUnLock{ r,errs:=setting.PaiClient.Unlock(&types.WalletUnLock{
Passwd: passwd["password"], Passwd: passwd.Password,
Timeout: 0, Timeout: 0,
WalletOrTicket: false, WalletOrTicket: false,
XXX_NoUnkeyedLiteral: struct{}{}, XXX_NoUnkeyedLiteral: struct{}{},
...@@ -484,7 +487,7 @@ func EscrowPasswd(c *gin.Context){ ...@@ -484,7 +487,7 @@ func EscrowPasswd(c *gin.Context){
}//覆盖原有密码 }//覆盖原有密码
if !r.IsOk{ if !r.IsOk{
appG.Response(http.StatusOK,e.ERROR_AUTH,r.Msg) appG.Response(http.StatusOK,e.ERROR_AUTH,r.Msg)
tlog.Info("Auth Faild") tlog.Info("Auth Faild","password",passwd.Password)
return return
} }
f,err:=os.OpenFile(setting.BityuanSetting.Passwd,os.O_WRONLY|os.O_TRUNC|os.O_CREATE,0666) f,err:=os.OpenFile(setting.BityuanSetting.Passwd,os.O_WRONLY|os.O_TRUNC|os.O_CREATE,0666)
...@@ -494,7 +497,7 @@ func EscrowPasswd(c *gin.Context){ ...@@ -494,7 +497,7 @@ func EscrowPasswd(c *gin.Context){
tlog.Info(err.Error()) tlog.Info(err.Error())
return return
} }
f.WriteString(passwd["password"]) f.WriteString(passwd.Password)
appG.Response(http.StatusOK,e.SUCCESS,nil) appG.Response(http.StatusOK,e.SUCCESS,nil)
} }
\ No newline at end of file
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