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.
 
 
 
 
 

147 lines
5.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 p, .section label {
  7. font-size: 0.86em;
  8. }
  9. .oauth-provider img {
  10. max-height: 2.75em;
  11. vertical-align: middle;
  12. }
  13. </style>
  14. <div class="content-container snug">
  15. {{if .Silenced}}
  16. {{template "user-silenced"}}
  17. {{end}}
  18. <h1>{{if .IsLogOut}}Before you go...{{else}}Account Settings {{if .IsAdmin}}<a href="/admin">admin settings</a>{{end}}{{end}}</h1>
  19. {{if .Flashes}}<ul class="errors">
  20. {{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
  21. </ul>{{end}}
  22. {{ if .IsLogOut }}
  23. <div class="alert info">
  24. <p class="introduction">Please add an <strong>email address</strong> and/or <strong>passphrase</strong> so you can log in again later.</p>
  25. </div>
  26. {{ else }}
  27. <div>
  28. <p>Change your account settings here.</p>
  29. </div>
  30. <form method="post" action="/api/me/self" autocomplete="false">
  31. <div class="option">
  32. <h3>Username</h3>
  33. <div class="section">
  34. <input type="text" name="username" value="{{.Username}}" tabindex="1" />
  35. <input type="submit" value="Update" style="margin-left: 1em;" />
  36. </div>
  37. </div>
  38. </form>
  39. {{ end }}
  40. <form method="post" action="/api/me/self" autocomplete="false">
  41. <input type="hidden" name="logout" value="{{.IsLogOut}}" />
  42. <div class="option">
  43. <h3>Passphrase</h3>
  44. <div class="section">
  45. {{if and (not .HasPass) (not .IsLogOut)}}<div class="alert info"><p>Add a passphrase to easily log in to your account.</p></div>{{end}}
  46. {{if .HasPass}}<p>Current passphrase</p>
  47. <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>
  48. <p>New passphrase</p>
  49. {{end}}
  50. {{if .IsLogOut}}<input type="text" value="{{.Username}}" style="display:none" />{{end}}
  51. <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>
  52. </div>
  53. </div>
  54. <div class="option">
  55. <h3>Email</h3>
  56. <div class="section">
  57. {{if and (not .Email) (not .IsLogOut)}}<div class="alert info"><p>Add your email to get:</p>
  58. <ul>
  59. <li>No-passphrase login</li>
  60. <li>Account recovery if you forget your passphrase</li>
  61. </ul></div>{{end}}
  62. <input type="email" name="email" style="letter-spacing: 1px" placeholder="Email address" value="{{.Email}}" size="40" tabindex="{{if .IsLogOut}}2{{else}}3{{end}}" />
  63. </div>
  64. </div>
  65. <div class="option" style="text-align: center;">
  66. <input type="submit" value="Save changes" tabindex="4" />
  67. </div>
  68. </form>
  69. {{ if .OauthSection }}
  70. <hr />
  71. {{ if .OauthAccounts }}
  72. <div class="option">
  73. <h2>Linked Accounts</h2>
  74. <p>These are your linked external accounts.</p>
  75. {{ range $oauth_account := .OauthAccounts }}
  76. <form method="post" action="/api/me/oauth/remove" autocomplete="false">
  77. <input type="hidden" name="provider" value="{{ $oauth_account.Provider }}" />
  78. <input type="hidden" name="client_id" value="{{ $oauth_account.ClientID }}" />
  79. <input type="hidden" name="remote_user_id" value="{{ $oauth_account.RemoteUserID }}" />
  80. <div class="section oauth-provider">
  81. <img src="/img/mark/{{$oauth_account.Provider}}.png" alt="{{ $oauth_account.Provider | title }}" />
  82. <input type="submit" value="Remove {{ $oauth_account.Provider | title }}" />
  83. </div>
  84. </form>
  85. {{ end }}
  86. </div>
  87. {{ end }}
  88. {{ if or .OauthSlack .OauthWriteAs .OauthGitLab }}
  89. <div class="option">
  90. <h2>Link External Accounts</h2>
  91. <p>Connect additional accounts to enable logging in with those providers, instead of using your username and password.</p>
  92. <div class="row">
  93. {{ if .OauthWriteAs }}
  94. <div class="section oauth-provider">
  95. <img src="/img/mark/writeas.png" alt="Write.as" />
  96. <a class="btn cta loginbtn" id="writeas-login" href="/oauth/write.as?attach=t">
  97. Link <strong>Write.as</strong>
  98. </a>
  99. </div>
  100. {{ end }}
  101. {{ if .OauthSlack }}
  102. <div class="section oauth-provider">
  103. <img src="/img/mark/slack.png" alt="Slack" />
  104. <a class="btn cta loginbtn" href="/oauth/slack?attach=t">
  105. Link <strong>Slack</strong>
  106. </a>
  107. </div>
  108. {{ end }}
  109. {{ if .OauthGitLab }}
  110. <div class="section oauth-provider">
  111. <img src="/img/mark/gitlab.png" alt="GitLab" />
  112. <a class="btn cta loginbtn" id="gitlab-login" href="/oauth/gitlab?attach=t">
  113. Link <strong>{{.GitLabDisplayName}}</strong>
  114. </a>
  115. </div>
  116. {{ end }}
  117. </div>
  118. </div>
  119. {{ end }}
  120. {{ end }}
  121. </div>
  122. <script>
  123. var showChecks = document.querySelectorAll('input.show');
  124. for (var i=0; i<showChecks.length; i++) {
  125. showChecks[i].addEventListener('click', function() {
  126. var prevEl = this.previousElementSibling;
  127. if (prevEl.type == "password") {
  128. prevEl.type = "text";
  129. } else {
  130. prevEl.type = "password";
  131. }
  132. });
  133. }
  134. </script>
  135. {{template "footer" .}}
  136. {{end}}