error.go 708 B

123456789101112131415161718
  1. package auth
  2. import "net/http"
  3. // == define error HTML here ==
  4. const oauthNotConfigured = `<!DOCTYPE html><html>
  5. <body>
  6. <h3>Your Netmaker server does not have OAuth configured.</h3>
  7. <p>Please visit the docs <a href="https://docs.netmaker.org/oauth.html" target="_blank" rel="noopener">here</a> to learn how to.</p>
  8. </body>
  9. </html>`
  10. // handleOauthNotConfigured - returns an appropriate html page when oauth is not configured on netmaker server but an oauth login was attempted
  11. func handleOauthNotConfigured(response http.ResponseWriter) {
  12. response.Header().Set("Content-Type", "text/html; charset=utf-8")
  13. response.WriteHeader(http.StatusInternalServerError)
  14. response.Write([]byte(oauthNotConfigured))
  15. }