templates.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. package gold
  2. var (
  3. // Apps contains a list of default apps that get server instead of RDF
  4. Apps = map[string]string{
  5. "newCert": `<!DOCTYPE html>
  6. <html id="docHTML">
  7. <body>
  8. <form method="POST" action="/` + SystemPrefix + `/cert">
  9. <h2>Issue new certificate</h2>
  10. Name: <input type="text" name="name">
  11. WebID: <input type="text" name="webid" autocorrect="off">
  12. <keygen id="spkacWebID" name="spkac" challenge="randomchars" keytype="rsa" hidden></keygen>
  13. <input type="submit" value="Issue">
  14. </form>
  15. </body>
  16. </html>`,
  17. "accountRecovery": `<!DOCTYPE html>
  18. <html id="docHTML">
  19. <body>
  20. <h2>Recover access to your account</h2>
  21. <form method="POST">
  22. What is your WebID?
  23. <br>
  24. <input type="url" name="webid" autocorrect="off">
  25. <input type="submit" value="Recover account">
  26. </form>
  27. </body>
  28. </html>`,
  29. "401": `<!DOCTYPE html>
  30. <html id="docHTML">
  31. <head>
  32. </head>
  33. <body>
  34. <h1>401 - Unauthorized! You need to authenticate to access this resource.</h1>
  35. <form method="POST" action="/` + SystemPrefix + `/login">
  36. <h2>Login</h2>
  37. WebID:
  38. <br>
  39. <input type="url" name="webid" autocorrect="off">
  40. <br>
  41. Password:
  42. <br>
  43. <input type="password" name="password">
  44. <br>
  45. <input type="submit" value="Login">
  46. </form>
  47. <p><a href="/` + SystemPrefix + `/recovery">Forgot your password?</a></p>
  48. <br>
  49. <p>Do you need a WebID? You can sign up for one at <a href="https://databox.me/" target="_blank">databox.me</a>.</p>
  50. </body>
  51. </html>`,
  52. "403": `<!DOCTYPE html>
  53. <html id="docHTML">
  54. <head>
  55. </head>
  56. <body>
  57. <h1>403 - oh noes, access denied!</h1>
  58. <h2>Please visit the <a href="/` + SystemPrefix + `/accountRecovery">recovery page</a> in case you have lost access to your credentials.</h2>
  59. </body>
  60. </html>`,
  61. }
  62. // SMTPTemplates contains a list of templates for sending emails
  63. SMTPTemplates = map[string]string{
  64. "accountRecovery": `<p>Hello,</p>
  65. <p>We have a received a request to recover you account, originating from <strong>{{.IP}}</strong>. Please ignore this email if you did not send this request.</p>
  66. <p>Click the following link to recover your account: <a href="{{.Link}}" target="_blank">{{.Link}}</a></p>
  67. <p>This email was generated automatically. No one will respond if you reply to it.</p>
  68. <p>Sincerely,
  69. <p>{{.Host}} team</p>
  70. `,
  71. "welcomeMail": `<p>Hi there {{.Name}}!</p>
  72. <br>
  73. <p>It looks like you have successfully created your Solid account on {{.Host}}. Congratulations!</p>
  74. <p>Your WebID (identifier) is: {{.WebID}}.</p>
  75. <p>You can start browsing your files here: {{.Account}}.</p>
  76. <p>We would like to reassure you that we will not use your email address for any other purpose than allowing you to authenticate and/or recover your account credentials.</p>
  77. <p>Best,</p>
  78. <p>{{.Host}} team</p>
  79. `,
  80. }
  81. )
  82. func NewPassTemplate(token string, err string) string {
  83. template := `<!DOCTYPE html>
  84. <html id="docHTML">
  85. <body>
  86. <form method="POST" action="/` + SystemPrefix + `/recovery?token=` + token + `">
  87. <h2>Please provide a new password</h2>
  88. <p style="color: red;">` + err + `</p>
  89. Password:
  90. <br>
  91. <input type="password" name="password">
  92. <br>
  93. Password (type again to verify):
  94. <br>
  95. <input type="password" name="verifypass">
  96. <br>
  97. <input type="submit" value="Submit">
  98. </form>
  99. </body>
  100. </html>`
  101. return template
  102. }
  103. func LoginTemplate(redir, origin, webid string) string {
  104. template := `<!DOCTYPE html>
  105. <html id="docHTML">
  106. <body>
  107. <form method="POST" action="/` + SystemPrefix + `/login?redirect=` + redir + `&origin=` + origin + `">
  108. <h2>Login</h2>
  109. WebID:
  110. <br>
  111. <input type="url" name="webid" value="` + webid + `" autocorrect="off">
  112. <br>
  113. Password:
  114. <br>
  115. <input type="password" name="password" autofocus>
  116. <br>
  117. <input type="submit" value="Login">
  118. </form>
  119. <p><a href="/` + SystemPrefix + `/recovery">Forgot your password?</a></p>
  120. <br>
  121. <p>Do you need a WebID? You can sign up for one at <a href="https://databox.me/" target="_blank">databox.me</a>.</p>
  122. </body>
  123. </html>`
  124. return template
  125. }
  126. func UnauthorizedTemplate(redirTo, webid string) string {
  127. template := `<!DOCTYPE html>
  128. <html id="docHTML">
  129. <head>
  130. </head>
  131. <body>
  132. <h1>401 - Unauthorized! You need to authenticate to access this resource.</h1>
  133. <form method="POST" action="/` + SystemPrefix + `/login?redirect=` + redirTo + `">
  134. <h2>Login</h2>
  135. WebID:
  136. <br>
  137. <input type="url" name="webid" value="` + webid + `" autocorrect="off">
  138. <br>
  139. Password:
  140. <br>
  141. <input type="password" name="password" autofocus>
  142. <br>
  143. <input type="submit" value="Login">
  144. </form>
  145. <p><a href="/` + SystemPrefix + `/recovery">Forgot your password?</a></p>
  146. <br>
  147. <p>Do you need a WebID? You can sign up for one at <a href="https://databox.me/" target="_blank">databox.me</a>.</p>
  148. </body>
  149. </html>`
  150. return template
  151. }
  152. func LogoutTemplate(webid string) string {
  153. template := `<!DOCTYPE html>
  154. <html id="docHTML">
  155. <head>
  156. </head>
  157. <body>
  158. <h1>You are logged in as ` + webid + `.</h1>
  159. <h2><a href="/` + SystemPrefix + `/logout">Click here to logout</a></h2>
  160. </body>
  161. </html>`
  162. return template
  163. }
  164. func TokensTemplate(tokens string) string {
  165. template := `<!DOCTYPE html>
  166. <html id="docHTML">
  167. <head>
  168. </head>
  169. <body>
  170. ` + tokens + `
  171. </body>
  172. </html>`
  173. return template
  174. }