diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/channel.go | 12 | ||||
-rw-r--r-- | api/user.go | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/api/channel.go b/api/channel.go index a27b3c1bf..ff5b0f8da 100644 --- a/api/channel.go +++ b/api/channel.go @@ -301,11 +301,11 @@ func PostUpdateChannelHeaderMessageAndForget(c *Context, channelId string, oldCh var message string if oldChannelHeader == "" { - message = fmt.Sprintf(c.T("api.channel.post_update_channel_header_message_and_forget.updated_to"), user.Username, newChannelHeader) + message = fmt.Sprintf(utils.T("api.channel.post_update_channel_header_message_and_forget.updated_to"), user.Username, newChannelHeader) } else if newChannelHeader == "" { - message = fmt.Sprintf(c.T("api.channel.post_update_channel_header_message_and_forget.removed"), user.Username, oldChannelHeader) + message = fmt.Sprintf(utils.T("api.channel.post_update_channel_header_message_and_forget.removed"), user.Username, oldChannelHeader) } else { - message = fmt.Sprintf(c.T("api.channel.post_update_channel_header_message_and_forget.updated_from"), user.Username, oldChannelHeader, newChannelHeader) + message = fmt.Sprintf(utils.T("api.channel.post_update_channel_header_message_and_forget.updated_from"), user.Username, oldChannelHeader, newChannelHeader) } post := &model.Post{ @@ -460,7 +460,7 @@ func JoinChannel(c *Context, channelId string, role string) { c.Err = err return } - PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(c.T("api.channel.join_channel.post_and_forget"), user.Username)) + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(utils.T("api.channel.join_channel.post_and_forget"), user.Username)) } else { c.Err = model.NewLocAppError("join", "api.channel.join_channel.permissions.app_error", nil, "") c.Err.StatusCode = http.StatusForbidden @@ -578,7 +578,7 @@ func leave(c *Context, w http.ResponseWriter, r *http.Request) { RemoveUserFromChannel(c.Session.UserId, c.Session.UserId, channel) - PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(c.T("api.channel.leave.left"), user.Username)) + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(utils.T("api.channel.leave.left"), user.Username)) result := make(map[string]string) result["id"] = channel.Id @@ -849,7 +849,7 @@ func addMember(c *Context, w http.ResponseWriter, r *http.Request) { c.LogAudit("name=" + channel.Name + " user_id=" + userId) - PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(c.T("api.channel.add_member.added"), nUser.Username, oUser.Username)) + PostUserAddRemoveMessageAndForget(c, channel.Id, fmt.Sprintf(utils.T("api.channel.add_member.added"), nUser.Username, oUser.Username)) <-Srv.Store.Channel().UpdateLastViewedAt(id, oUser.Id) w.Write([]byte(cm.ToJson())) diff --git a/api/user.go b/api/user.go index 507c83d28..8f381aeda 100644 --- a/api/user.go +++ b/api/user.go @@ -31,6 +31,7 @@ import ( "net/url" "strconv" "strings" + "time" ) func InitUser(r *mux.Router) { @@ -633,12 +634,14 @@ func Login(c *Context, w http.ResponseWriter, r *http.Request, user *model.User, } multiToken = strings.TrimSpace(multiToken + " " + session.Token) + expiresAt := time.Unix(model.GetMillis()/1000+int64(maxAge), 0) multiSessionCookie := &http.Cookie{ Name: model.SESSION_COOKIE_TOKEN, Value: multiToken, Path: "/", MaxAge: maxAge, + Expires: expiresAt, HttpOnly: true, } @@ -793,7 +796,7 @@ func attachDeviceId(c *Context, w http.ResponseWriter, r *http.Request) { return } - w.Write([]byte(deviceId)) + w.Write([]byte(model.MapToJson(props))) } func RevokeSessionById(c *Context, sessionId string) { |