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.
 
 
 
 
 

161 lines
3.9 KiB

  1. {{define "view-user"}}
  2. {{template "header" .}}
  3. <style>
  4. table.classy th {
  5. text-align: left;
  6. }
  7. h3 {
  8. font-weight: normal;
  9. }
  10. td.active-silence {
  11. display: flex;
  12. align-items: center;
  13. }
  14. td.active-silence > input[type="submit"] {
  15. margin-left: auto;
  16. margin-right: 5%;
  17. }
  18. @media only screen and (max-width: 500px) {
  19. td.active-silence {
  20. flex-wrap: wrap;
  21. }
  22. td.active-silence > input[type="submit"] {
  23. margin: auto;
  24. }
  25. }
  26. input.copy-text {
  27. text-align: center;
  28. font-size: 1.2em;
  29. color: #555;
  30. width: 100%;
  31. box-sizing: border-box;
  32. }
  33. </style>
  34. <div class="snug content-container">
  35. {{template "admin-header" .}}
  36. <h2 id="posts-header">{{.User.Username}}</h2>
  37. {{if .NewPassword}}<div class="alert success">
  38. <p>This user's password has been reset to:</p>
  39. <p><input type="text" class="copy-text" value="{{.NewPassword}}" onfocus="if (this.select) this.select(); else this.setSelectionRange(0, this.value.length);" readonly /></p>
  40. <p>They can use this new password to log in to their account. <strong>This will only be shown once</strong>, so be sure to copy it and send it to them now.</p>
  41. {{if .ClearEmail}}<p>Their email address is: <a href="mailto:{{.ClearEmail}}">{{.ClearEmail}}</a></p>{{end}}
  42. </div>
  43. {{end}}
  44. <table class="classy export">
  45. <tr>
  46. <th>No.</th>
  47. <td>{{.User.ID}}</td>
  48. </tr>
  49. <tr>
  50. <th>Type</th>
  51. <td>{{if .User.IsAdmin}}Admin{{else}}User{{end}}</td>
  52. </tr>
  53. <tr>
  54. <th>Username</th>
  55. <td>{{.User.Username}}</td>
  56. </tr>
  57. <tr>
  58. <th>Joined</th>
  59. <td>{{.User.CreatedFriendly}}</td>
  60. </tr>
  61. <tr>
  62. <th>Total Posts</th>
  63. <td>{{.TotalPosts}}</td>
  64. </tr>
  65. <tr>
  66. <th>Last Post</th>
  67. <td>{{if .LastPost}}{{.LastPost}}{{else}}Never{{end}}</td>
  68. </tr>
  69. <tr>
  70. <form action="/admin/user/{{.User.Username}}/status" method="POST" {{if not .User.IsSilenced}}onsubmit="return confirmSilence()"{{end}}>
  71. <a id="status"/>
  72. <th>Status</th>
  73. <td class="active-silence">
  74. {{if .User.IsSilenced}}
  75. <p>Silenced</p>
  76. <input type="submit" value="Unsilence"/>
  77. {{else}}
  78. <p>Active</p>
  79. <input class="danger" type="submit" value="Silence" {{if .User.IsAdmin}}disabled{{end}}/>
  80. {{end}}
  81. </td>
  82. </form>
  83. </tr>
  84. <tr>
  85. <th>Password</th>
  86. <td>
  87. {{if ne .Username .User.Username}}
  88. <form id="reset-form" action="/admin/user/{{.User.Username}}/passphrase" method="post" autocomplete="false">
  89. <input type="hidden" name="user" value="{{.User.ID}}"/>
  90. <button type="submit">Reset</button>
  91. </form>
  92. {{else}}
  93. <a href="/me/settings" title="Go to reset password page">Change your password</a>
  94. {{end}}
  95. </td>
  96. </tr>
  97. </table>
  98. <h2>Blogs</h2>
  99. {{range .Colls}}
  100. <h3><a href="/{{.Alias}}/">{{.Title}}</a></h3>
  101. <table class="classy export">
  102. <tr>
  103. <th>Alias</th>
  104. <td>{{.Alias}}</td>
  105. </tr>
  106. <tr>
  107. <th>Title</th>
  108. <td>{{.Title}}</td>
  109. </tr>
  110. <tr>
  111. <th>Description</th>
  112. <td>{{.Description}}</td>
  113. </tr>
  114. <tr>
  115. <th>Visibility</th>
  116. <td>{{.FriendlyVisibility}}</td>
  117. </tr>
  118. <tr>
  119. <th>Views</th>
  120. <td>{{.Views}}</td>
  121. </tr>
  122. <tr>
  123. <th>Posts</th>
  124. <td>{{.TotalPosts}}</td>
  125. </tr>
  126. <tr>
  127. <th>Last Post</th>
  128. <td>{{if .LastPost}}{{.LastPost}}{{else}}Never{{end}}</td>
  129. </tr>
  130. {{if $.Config.Federation}}
  131. <tr>
  132. <th>Fediverse Followers</th>
  133. <td>{{.Followers}}</td>
  134. </tr>
  135. {{end}}
  136. </table>
  137. {{end}}
  138. </div>
  139. <script type="text/javascript">
  140. function confirmSilence() {
  141. return confirm("Silence this user? They'll still be able to log in and access their posts, but no one else will be able to see them anymore. You can reverse this decision at any time.");
  142. }
  143. form = document.getElementById("reset-form");
  144. form.addEventListener('submit', function(e) {
  145. e.preventDefault();
  146. agreed = confirm("Reset this user's password? This will generate a new temporary password that you'll need to share with them, and invalidate their old one.");
  147. if (agreed === true) {
  148. form.submit();
  149. }
  150. });
  151. </script>
  152. {{template "footer" .}}
  153. {{end}}