summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-08-27 08:18:59 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-08-27 08:18:59 -0400
commit232fd59ef424017ae2c881d03a68707421eb74e5 (patch)
tree70ce6dd363e6f308d20bcc198020d9e7770fd072 /api
parent378f0b52c10d3b9dc670da34a0043b7e05f3e93c (diff)
parent6ac39ef687238def1a7175e52bba67d388a70564 (diff)
downloadchat-232fd59ef424017ae2c881d03a68707421eb74e5.tar.gz
chat-232fd59ef424017ae2c881d03a68707421eb74e5.tar.bz2
chat-232fd59ef424017ae2c881d03a68707421eb74e5.zip
Merge pull request #470 from nickago/MM-1945
MM-1945 Added a link to error page that returns users to the root page
Diffstat (limited to 'api')
-rw-r--r--api/context.go21
-rw-r--r--api/templates/error.html1
2 files changed, 18 insertions, 4 deletions
diff --git a/api/context.go b/api/context.go
index 8babf85f2..aaf304e2c 100644
--- a/api/context.go
+++ b/api/context.go
@@ -4,14 +4,15 @@
package api
import (
- l4g "code.google.com/p/log4go"
- "github.com/mattermost/platform/model"
- "github.com/mattermost/platform/store"
- "github.com/mattermost/platform/utils"
"net"
"net/http"
"net/url"
"strings"
+
+ l4g "code.google.com/p/log4go"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
+ "github.com/mattermost/platform/utils"
)
var sessionCache *utils.Cache = utils.NewLru(model.SESSION_CACHE_SIZE)
@@ -431,10 +432,22 @@ func IsPrivateIpAddress(ipAddress string) bool {
}
func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) {
+
+ protocol := "http"
+ if utils.Cfg.ServiceSettings.UseSSL {
+ forwardProto := r.Header.Get(model.HEADER_FORWARDED_PROTO)
+ if forwardProto != "http" {
+ protocol = "https"
+ }
+ }
+
+ SiteURL := protocol + "://" + r.Host
+
m := make(map[string]string)
m["Message"] = err.Message
m["Details"] = err.DetailedError
m["SiteName"] = utils.Cfg.ServiceSettings.SiteName
+ m["SiteURL"] = SiteURL
w.WriteHeader(err.StatusCode)
ServerTemplates.ExecuteTemplate(w, "error.html", m)
diff --git a/api/templates/error.html b/api/templates/error.html
index f38bb81a1..3474c9e1e 100644
--- a/api/templates/error.html
+++ b/api/templates/error.html
@@ -14,6 +14,7 @@
<div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div>
<h2>{{ .SiteName }} needs your help:</h2>
<p>{{.Message}}</p>
+ <a href="{{.SiteURL}}">Go back to team site</a>
</div>
</div>
</body>