templates.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package auth
  2. import "html/template"
  3. type ssoCallbackTemplateConfig struct {
  4. User string
  5. Verb string
  6. }
  7. var ssoCallbackTemplate = template.Must(
  8. template.New("ssocallback").Parse(`<!DOCTYPE html>
  9. <html lang="en">
  10. <head>
  11. <meta charset="UTF-8">
  12. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  13. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  14. <title>Netmaker :: SSO Success</title>
  15. <style>
  16. html,
  17. body {
  18. margin: 0px;
  19. padding: 0px;
  20. }
  21. body {
  22. height: 100vh;
  23. overflow: hidden;
  24. display: flex;
  25. flex-flow: column nowrap;
  26. justify-content: center;
  27. align-items: center;
  28. }
  29. #logo {
  30. width: 150px;
  31. }
  32. h3 {
  33. margin-bottom: 3rem;
  34. color: rgb(25, 135, 84);
  35. font-size: xx-large;
  36. }
  37. h4 {
  38. margin-bottom: 0px;
  39. }
  40. p {
  41. margin-top: 0px;
  42. margin-bottom: 0px;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <img
  48. src="https://raw.githubusercontent.com/gravitl/netmaker-docs/master/images/netmaker-github/netmaker-teal.png"
  49. alt="netmaker logo"
  50. id="logo"
  51. >
  52. <h3>Server SSO Success</h3>
  53. <h4>User {{.User}} has been successfully {{.Verb}}.</h4>
  54. <p>You can close this window now</p>
  55. </body>
  56. </html>`),
  57. )
  58. var ssoErrCallbackTemplate = template.Must(
  59. template.New("ssocallback").Parse(`<!DOCTYPE html>
  60. <html lang="en">
  61. <head>
  62. <meta charset="UTF-8">
  63. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  64. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  65. <title>Netmaker :: SSO Error</title>
  66. <style>
  67. html, body {
  68. margin: 0px;
  69. padding: 0px;
  70. }
  71. body {
  72. height: 100vh;
  73. overflow: hidden;
  74. display: flex;
  75. flex-flow: column nowrap;
  76. justify-content: center;
  77. align-items: center;
  78. }
  79. #logo {
  80. width: 150px;
  81. }
  82. h3 {
  83. margin-bottom: 3rem;
  84. color:rgb(223, 71, 89);
  85. font-size: xx-large;
  86. }
  87. h4 {
  88. margin-top: 0rem;
  89. }
  90. p {
  91. margin-top: 3rem;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <img
  97. src="https://raw.githubusercontent.com/gravitl/netmaker-docs/master/images/netmaker-github/netmaker-teal.png"
  98. alt="netmaker logo"
  99. id="logo"
  100. >
  101. <h3>Server SSO Error</h3>
  102. <h4>Error reason: {.Verb}</h4>
  103. <em>Your Netmaker server may not have SSO configured properly.</em>
  104. <em>
  105. Please visit the <a href="https://docs.netmaker.org/oauth.html" target="_blank" rel="noopener">docs</a> for more information.
  106. </em>
  107. <p>
  108. If you feel this is a mistake, please contact your network administrator.
  109. </p>
  110. </body>
  111. </html>`),
  112. )