Commit 230b533b authored by chenhan wang's avatar chenhan wang
Browse files

version

parent 9d8521e6
......@@ -34,7 +34,6 @@ type File struct {
//Content string `json:"content"`
}
type pass struct {
SessionId string `json:"sessionId"`
Passwd string `json:"passwd"`
......@@ -63,7 +62,7 @@ func AskPasswd(c echo.Context) error {
return echo.ErrBadRequest
}
if model.Createlink(info.SessionId,info.Passwd,info.FileLink)==true{
if model.Createlink(info.SessionId, info.Passwd, info.FileLink) == true {
// 成功建立连接
SetCookie(c, info)
return c.String(http.StatusOK, "登录成功")
......@@ -142,12 +141,12 @@ func RecvFile(c echo.Context) error {
}
// 更新数据库
dinfo:=model.Users{
dinfo := model.Users{
Username: info.User,
Passwd: info.Passwd,
Name:info.FileName,// 无后缀
Name: info.FileName, // 无后缀
Size: uint(fi.Size()),
Route:filePath,
Route: filePath,
//Time1: info.Expiry,
}
model.Createuser(dinfo) // 数据库一条新纪录
......@@ -166,12 +165,12 @@ func SendFile(c echo.Context) error {
info.FileType = "txt"
}
if model.find(info.FileLink,info.SessionId,)==false{
cookie,err:=c.Cookie(info.SessionId)
if err!=nil{
if model.find(info.FileLink, info.SessionId) == false {
cookie, err := c.Cookie(info.SessionId)
if err != nil {
return err
}
if cookie.Value!=info.FileLink{
if cookie.Value != info.FileLink {
return err // you wenti
}
}
......
Supports Markdown
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