A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

90 lines
3.1 KiB

  1. {{define "settings"}}
  2. {{template "header" .}}
  3. <style type="text/css">
  4. .option { margin: 2em 0em; }
  5. h3 { font-weight: normal; }
  6. .section > *:not(input) { font-size: 0.86em; }
  7. </style>
  8. <div class="content-container snug regular">
  9. <h2>{{if .IsLogOut}}Before you go...{{else}}Account Settings {{if .IsAdmin}}<a href="/admin">admin settings</a>{{end}}{{end}}</h2>
  10. {{if .Flashes}}<ul class="errors">
  11. {{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
  12. </ul>{{end}}
  13. {{if .Suspended}}
  14. <div class="alert info">
  15. <p>This account is currently suspended.</p>
  16. <p>Please contact the instance administrator to discuss reactivation.</p>
  17. </div>
  18. {{end}}
  19. {{ if .IsLogOut }}
  20. <div class="alert info">
  21. <p class="introduction">Please add an <strong>email address</strong> and/or <strong>passphrase</strong> so you can log in again later.</p>
  22. </div>
  23. {{ else }}
  24. <div class="option">
  25. <p>Change your account settings here.</p>
  26. </div>
  27. <form method="post" action="/api/me/self" autocomplete="false">
  28. <div class="option">
  29. <h3>Username</h3>
  30. <div class="section">
  31. <input type="text" name="username" value="{{.Username}}" tabindex="1" />
  32. <input type="submit" value="Update" style="margin-left: 1em;" />
  33. </div>
  34. </div>
  35. </form>
  36. {{ end }}
  37. <form method="post" action="/api/me/self" autocomplete="false">
  38. <input type="hidden" name="logout" value="{{.IsLogOut}}" />
  39. <div class="option">
  40. <h3>Passphrase</h3>
  41. <div class="section">
  42. {{if and (not .HasPass) (not .IsLogOut)}}<div class="alert info"><p>Add a passphrase to easily log in to your account.</p></div>{{end}}
  43. {{if .HasPass}}<p>Current passphrase</p>
  44. <input type="password" name="current-pass" placeholder="Current passphrase" tabindex="1" /> <input class="show" type="checkbox" id="show-cur-pass" /><label for="show-cur-pass"> Show</label>
  45. <p>New passphrase</p>
  46. {{end}}
  47. {{if .IsLogOut}}<input type="text" value="{{.Username}}" style="display:none" />{{end}}
  48. <input type="password" name="new-pass" autocomplete="new-password" placeholder="New passphrase" tabindex="{{if .IsLogOut}}1{{else}}2{{end}}" /> <input class="show" type="checkbox" id="show-new-pass" /><label for="show-new-pass"> Show</label>
  49. </div>
  50. </div>
  51. <div class="option">
  52. <h3>Email</h3>
  53. <div class="section">
  54. {{if and (not .Email) (not .IsLogOut)}}<div class="alert info"><p>Add your email to get:</p>
  55. <ul>
  56. <li>No-passphrase login</li>
  57. <li>Account recovery if you forget your passphrase</li>
  58. </ul></div>{{end}}
  59. <input type="email" name="email" style="letter-spacing: 1px" placeholder="Email address" value="{{.Email}}" size="40" tabindex="{{if .IsLogOut}}2{{else}}3{{end}}" />
  60. </div>
  61. </div>
  62. <div class="option" style="text-align: center; margin-top: 4em;">
  63. <input type="submit" value="Save changes" tabindex="4" />
  64. </div>
  65. </form>
  66. </div>
  67. <script>
  68. var showChecks = document.querySelectorAll('input.show');
  69. for (var i=0; i<showChecks.length; i++) {
  70. showChecks[i].addEventListener('click', function() {
  71. var prevEl = this.previousElementSibling;
  72. if (prevEl.type == "password") {
  73. prevEl.type = "text";
  74. } else {
  75. prevEl.type = "password";
  76. }
  77. });
  78. }
  79. </script>
  80. {{template "footer" .}}
  81. {{end}}