增加默认用户密码

pull/30/head
taoshihan1991 4 years ago
parent 3679cff4c8
commit 9b3f1f3155

@ -6,6 +6,13 @@ import (
)
func AuthLocal(username string,password string)string{
account:=config.GetAccount()
if account==nil{
account=make(map[string]string)
}
if account["Username"]=="" && account["Password"]==""{
account["Username"]="admin"
account["Password"]="admin123"
}
if username==account["Username"] && password==account["Password"]{
sessionId:=tools.Md5(username)
@ -19,6 +26,7 @@ func AuthLocal(username string,password string)string{
//验证是否已经登录
func AuthCheck(uid string)map[string]string{
info:=config.GetUserInfo(uid)
return info
}

@ -227,7 +227,7 @@ func sendPingToClient(){
}
go func() {
for{
log.Println(2)
log.Println("check online users...")
str,_:=json.Marshal(msg);sendStr:=string(str)
for uid, conn := range clientList {
err:=websocket.Message.Send(conn,sendStr)

@ -0,0 +1 @@
package controller

@ -47,6 +47,8 @@ func main() {
mux.Handle("/chat_server",websocket.Handler(controller.ChatServer))
//获取在线用户
mux.HandleFunc("/chat_users", controller.ChatUsers)
//设置mysql
mux.HandleFunc("/setting_mysql",controller.ActionChatPage)
//后台任务
controller.TimerSessFile()
//监听端口

@ -227,6 +227,9 @@
},
},
created: function () {
if (top.location != location){
top.location.href = location.href;
}
}
})

@ -64,7 +64,7 @@
el: '#app',
delimiters:["<{","}>"],
data: {
iframeUrl:"/setting",
iframeUrl:"/chat_main",
mailTotal:0,
},
methods: {

@ -1,5 +1,5 @@
<el-menu
default-active="4"
default-active="3"
mode="horizontal">
<el-menu-item class="mainLogo" v-on:click="openUrl('/login')">GO-FLY</el-menu-item>
<el-menu-item index="2" v-on:click="openIframeUrl('/list')">邮箱<el-badge class="mark" :value="mailTotal" style="margin-bottom: 20px;"/>

Loading…
Cancel
Save