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.
 
 
 
 
 

119 lines
4.6 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">
  9. {{if .Silenced}}
  10. {{template "user-silenced"}}
  11. {{end}}
  12. <h1>{{if .IsLogOut}}Before you go...{{else}}Account Settings {{if .IsAdmin}}<a href="/admin">admin settings</a>{{end}}{{end}}</h1>
  13. {{if .Flashes}}<ul class="errors">
  14. {{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
  15. </ul>{{end}}
  16. {{ if .IsLogOut }}
  17. <div class="alert info">
  18. <p class="introduction">Please add an <strong>email address</strong> and/or <strong>passphrase</strong> so you can log in again later.</p>
  19. </div>
  20. {{ else }}
  21. <div>
  22. <p>Change your account settings here.</p>
  23. </div>
  24. <form method="post" action="/api/me/self" autocomplete="false">
  25. <div class="option">
  26. <h3>Username</h3>
  27. <div class="section">
  28. <input type="text" name="username" value="{{.Username}}" tabindex="1" />
  29. <input type="submit" value="Update" style="margin-left: 1em;" />
  30. </div>
  31. </div>
  32. </form>
  33. {{ end }}
  34. <form method="post" action="/api/me/self" autocomplete="false">
  35. <input type="hidden" name="logout" value="{{.IsLogOut}}" />
  36. <div class="option">
  37. <h3>Passphrase</h3>
  38. <div class="section">
  39. {{if and (not .HasPass) (not .IsLogOut)}}<div class="alert info"><p>Add a passphrase to easily log in to your account.</p></div>{{end}}
  40. {{if .HasPass}}<p>Current passphrase</p>
  41. <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>
  42. <p>New passphrase</p>
  43. {{end}}
  44. {{if .IsLogOut}}<input type="text" value="{{.Username}}" style="display:none" />{{end}}
  45. <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>
  46. </div>
  47. </div>
  48. <div class="option">
  49. <h3>Email</h3>
  50. <div class="section">
  51. {{if and (not .Email) (not .IsLogOut)}}<div class="alert info"><p>Add your email to get:</p>
  52. <ul>
  53. <li>No-passphrase login</li>
  54. <li>Account recovery if you forget your passphrase</li>
  55. </ul></div>{{end}}
  56. <input type="email" name="email" style="letter-spacing: 1px" placeholder="Email address" value="{{.Email}}" size="40" tabindex="{{if .IsLogOut}}2{{else}}3{{end}}" />
  57. </div>
  58. </div>
  59. <div class="option" style="text-align: center; margin-top: 4em;">
  60. <input type="submit" value="Save changes" tabindex="4" />
  61. </div>
  62. </form>
  63. {{ if .OauthSection }}
  64. <h1>OAuth Management</h1>
  65. {{ if .OauthAccounts }}
  66. <p>Existing OAuth accounts can be removed from your account.</p>
  67. {{ range $oauth_account := .OauthAccounts }}
  68. <form method="post" action="/api/me/oauth/remove" autocomplete="false">
  69. <input type="hidden" name="provider" value="{{ $oauth_account.Provider }}" />
  70. <input type="hidden" name="client_id" value="{{ $oauth_account.ClientID }}" />
  71. <input type="hidden" name="remote_user_id" value="{{ $oauth_account.RemoteUserID }}" />
  72. <div class="option">
  73. <div class="section">
  74. <input type="submit" value="Remove {{ $oauth_account.Provider | title }}" style="margin-left: 1em;" />
  75. </div>
  76. </div>
  77. </form>
  78. {{ end }}
  79. {{ end }}
  80. {{ if or .OauthSlack .OauthWriteAs }}
  81. <p>
  82. {{ if .OauthSlack }}
  83. <a class="loginbtn" href="/oauth/slack?attach=t"><img alt="Sign in with Slack" height="40" width="172" src="/img/sign_in_with_slack.png" srcset="/img/sign_in_with_slack.png 1x, /img/sign_in_with_slack@2x.png 2x" /></a>
  84. {{ end }}
  85. {{ if .OauthWriteAs }}
  86. <a class="btn cta loginbtn" id="writeas-login" href="/oauth/write.as?attach=t">Link your <strong>Write.as</strong> account.</a>
  87. {{ end }}
  88. {{ if .OauthGitLab }}
  89. <a class="btn cta loginbtn" id="gitlab-login" href="/oauth/gitlab?attach=t">Link your <strong>{{.GitLabDisplayName}}</strong> account</a>
  90. {{ end }}
  91. </p>
  92. {{ end }}
  93. {{ end }}
  94. </div>
  95. <script>
  96. var showChecks = document.querySelectorAll('input.show');
  97. for (var i=0; i<showChecks.length; i++) {
  98. showChecks[i].addEventListener('click', function() {
  99. var prevEl = this.previousElementSibling;
  100. if (prevEl.type == "password") {
  101. prevEl.type = "text";
  102. } else {
  103. prevEl.type = "password";
  104. }
  105. });
  106. }
  107. </script>
  108. {{template "footer" .}}
  109. {{end}}