Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/templates/site/user/edit.jet.html
akuma06 d3e50b8ffd Fix User delete button (#1662)
* Fix User delete button

Fix #1652
This bug comes from the fact that @kiloutre edited how the form behave and instead of a GET request, do a POST one. However every POST request not in /api or /mod need a CSRF Token to work.

* Update userlist.jet.html

* Update index.jet.html
2017-10-15 01:34:45 +02:00

269 lignes
12 Kio
HTML
Brut Annotations Historique

Ce fichier contient des caractères Unicode invisibles.

Ce fichier contient des caractères Unicode invisibles à l'œil nu, mais peuvent être traités différemment par un ordinateur. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.

{{ extends "layouts/profile" }}
{{ import "layouts/partials/menu/profile" }}
{{ import "layouts/partials/helpers/csrf" }}
{{block title()}}{{ T("profile_edit_page", UserProfile.Username) }}{{end}}
{{ block profile_navigation()}}{{ yield profile_menu(route="profile_edit") }}{{end}}
{{block profile_content()}}
<h2 style="margin-top: 4px;">{{ T("personal_info")}}</h2>
<form role="form" method="POST">
{{ yield csrf_field()}}
<table class="user-edit-table">
<tbody>
<tr>
<td>{{ T("api_token") }}:</td>
<td><span style="font-family: monospace;">{{if UserProfile.APIToken == ""}}{{T("no_api_token")}}{{else}}{{UserProfile.APIToken}}{{end}}</span></td>
</tr>
<tr>
<td></td>
<td style="padding-bottom: 6px;"><a href="/apidoc">{{ T("api_documentation")}}</a> / <a class="form-input up-input" href="/user/{{ UserProfile.ID}}/{{UserProfile.Username }}/apireset">Reset API key</a></td>
</tr>
<tr>
<td><label for="email">{{ T("email_address") }}</label></td>
<td><input class="form-input up-input" placeholder="{{ T("email_placeholder")}}" type="text" name="email" id="email" value="{{UserProfile.Email}}"/></td>
</tr>
<tr>
<td><label for="language">{{ T("language")}}</label></td>
<td>
<select id="language" name="language" class="form-input up-input">
{{ userLanguage := UserProfile.Language }}
{{ range _, language := Languages }}
<option value="{{ language.Tag }}" {{ if userLanguage == language.Tag || userLanguage == language.Code || ((userLanguage == "") && (language.Tag == getDefaultLanguage())) }}selected{{end}}>{{ language.Name }} {{if language.Tag == getDefaultLanguage()}}({{ T("default") }}){{end}}</option>
{{ end }}
</select>
</td>
</tr>
{{ if !User.HasAdmin()}}
<tr>
<td><label for="current_password">{{ T("current_password") }}</label></td>
<td><input class="form-input up-input up-input" name="current_password" id="current_password" type="password"/></td>
</tr>
{{end}}
<tr>
<td><label for="password">{{ T("password") }}</label></td>
<td><input class="form-input up-input up-input" name="password" id="password" type="password"/></td>
</tr>
<tr>
<td><label for="password_confirmation">{{ T("confirm_password") }}</label></td>
<td><input class="form-input up-input up-input" name="password_confirmation" id="password" type="password"/></td>
</tr>
</tbody>
</table>
{{ yield errors(name="Email")}}
{{ yield errors(name="Language")}}
{{ if !User.HasAdmin()}}
{{ yield errors(name="CurrentPassword")}}
{{end}}
{{ yield errors(name="Password")}}
{{ yield errors(name="ConfirmPassword")}}
<h2>{{ T("preferences")}}</h2>
<table class="user-edit-table">
<tbody>
<tr>
<td><label for="theme">{{ T("theme") }}:</label></td>
<td>
<select id="theme-selector" name="theme" class="form-input up-input" onchange="switchThemes()">
<option value="">{{ T("theme_select")}}</option>
{{ range theme := getThemeList()}}
<option value="{{theme}}"{{ if Theme == theme}} selected{{end}}>{{formatThemeName(theme, T)}}</option>
{{end}}
<option value=""{{ if Theme == "" }} selected{{end}}>{{ T("theme_none")}}</option>
</select>
</td>
</tr>
<tr class="hidden">
<td><label for="anidex_api">Anidex API Token:</label></td>
<td><input disabled class="form-input up-input" placeholder="Coming soon..." type="text" name="anidex_api" id="anidex_api" value="{{UserProfile.AnidexAPIToken}}"/></td>
</tr>
<tr class="hidden">
<td><label for="nyaasi_api">Nyaa.si API Token:</label></td>
<td><input disabled class="form-input up-input" placeholder="Coming soon..." type="text" name="nyaasi_api" id="nyaasi_api" value="{{UserProfile.NyaasiAPIToken}}"/></td>
</tr>
<tr class="hidden">
<td><label for="tokyot_api">TokyoTosho API Token:</label></td>
<td><input disabled class="form-input up-input" placeholder="Coming soon..." type="text" name="tokyot_api" id="tokyot_api" value="{{UserProfile.TokyoTAPIToken }}"/></td>
</tr>
{{ if DefaultUserSettings("new_torrent")}}
<tr><td colspan="2" style="padding:0"><label for="new_torrent">{{ T("new_torrent_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_torrent" name="new_torrent" class="form-input up-input">
<option value="0" {{ if !UserProfile.Settings.Get("new_torrent") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_torrent") }}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_torrent_email")}}
<tr><td colspan="2" style="padding:0"><label for="new_torrent_email">{{ T("new_torrent_email_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_torrent_email" name="new_torrent_email" class="form-input up-input">
<option value="0" {{ if !UserProfile.Settings.Get("new_torrent_email") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_torrent_email")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_comment")}}
<tr><td colspan="2" style="padding:0"><label for="new_comment">{{ T("new_comment_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_comment" name="new_comment" class="form-input up-input">
<option value="0" {{ if !UserProfile.Settings.Get("new_comment") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_comment") }}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_comment_email")}}
<tr><td colspan="2" style="padding:0"><label for="new_comment_email">{{ T("new_comment_email_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_comment_email" name="new_comment_email" class="form-input up-input">
<option value="0" {{ if !UserProfile.Settings.Get("new_comment_email") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_comment_email") }}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_responses")}}
<tr><td colspan="2" style="padding:0"><label for="new_responses">{{ T("new_responses_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_responses" name="new_responses" class="form-input up-input">
<option value="0" {{ if !UserProfile.Settings.Get("new_responses") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_responses")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_responses_email")}}
<tr><td colspan="2" style="padding:0"><label for="new_responses_email">{{ T("new_responses_email_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_responses_email" name="new_responses_email" class="form-input up-input">
<option value="0" {{ if UserProfile.Settings.Get("new_responses_email") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_responses_email")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_follower")}}
<tr><td colspan="2" style="padding:0"><label for="new_follower">{{ T("new_follower_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_follower" name="new_follower" class="form-input up-input">
<option value="0" {{ if UserProfile.Settings.Get("new_follower") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_follower")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("new_follower_email")}}
<tr><td colspan="2" style="padding:0"><label for="new_follower_email">{{ T("new_follower_email_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="new_follower_email" name="new_follower_email" class="form-input up-input">
<option value="0" {{ if UserProfile.Settings.Get("new_follower_email") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("new_follower_email")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("followed")}}
<tr><td colspan="2" style="padding:0"><label for="followed">{{ T("followed_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="followed" name="followed" class="form-input up-input">
<option value="0" {{ if UserProfile.Settings.Get("followed") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("followed")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
{{ if DefaultUserSettings("followed_email")}}
<tr><td colspan="2" style="padding:0"><label for="followed_email">{{ T("followed_email_settings") }}</label></td></tr>
<tr>
<td colspan="2">
<select id="followed_email" name="followed_email" class="form-input up-input">
<option value="0" {{ if UserProfile.Settings.Get("followed_email") }}selected{{end}}>{{ T("no")}}</option>
<option value="1" {{ if UserProfile.Settings.Get("followed_email")}}selected{{end}}>{{ T("yes")}}</option>
</select>
</td>
</tr>
{{end}}
</tbody>
</table>
{{ if DefaultUserSettings("new_torrent")}}
{{ yield errors(name="NewTorrent")}}
{{end}}
{{ if DefaultUserSettings("new_torrent_email")}}
{{ yield errors(name="NewTorrentEmail")}}
{{end}}
{{ if DefaultUserSettings("new_comment")}}
{{ yield errors(name="NewComment")}}
{{end}}
{{ if DefaultUserSettings("new_comment_email")}}
{{ yield errors(name="NewCommentEmail")}}
{{end}}
{{ if DefaultUserSettings("new_responses")}}
{{ yield errors(name="NewResponses")}}
{{end}}
{{ if DefaultUserSettings("new_responses_email")}}
{{ yield errors(name="NewResponsesEmail")}}
{{end}}
{{ if DefaultUserSettings("new_follower")}}
{{ yield errors(name="NewFollower")}}
{{end}}
{{ if DefaultUserSettings("new_follower_email")}}
{{ yield errors(name="NewFollowerEmail")}}
{{end}}
{{ if DefaultUserSettings("followed")}}
{{ yield errors(name="Followed")}}
{{end}}
{{ if DefaultUserSettings("followed_email")}}
{{ yield errors(name="FollowedEmail")}}
{{end}}
{{ if User.HasAdmin()}}
<h2>{{ T("moderation")}}</h2>
<table class="user-edit-table">
<tbody>
<tr>
<td><label for="username">{{ T("moderation") }}:</label></td>
<td><input class="form-input up-input" name="username" id="username" type="text" value="{{UserProfile.Username}}"></td>
</tr>
<tr>
<td><label for="status">{{ T("role") }}:</label></td>
<td>
<select id="status" name="status" class="form-input up-input">
<option value="-1" {{ if UserProfile.Status == -1 }}selected{{end}}>{{ T("banned")}}</option>
<option value="0" {{ if UserProfile.Status == 0 }}selected{{end}}>{{ T("member")}} ({{ T("default") }})</option>
<option value="1" {{ if UserProfile.Status == 1 }}selected{{end}}>{{ T("trusted_member")}}</option>
{{ if UserProfile.Status == 2}}
<option value="2" selected>{{ T("moderator")}}</option>
{{end}}
<option value="3" {{ if UserProfile.Status == 3 }}selected{{end}}>{{ T("scraped_user")}}</option>
</select>
</td>
</tr>
</tbody>
</table>
{{ yield errors(name="Username")}}
{{ yield errors(name="Status")}}
{{end}}
<input type="submit" class="form-input btn-green" name="save" value="{{ T("save_changes")}}">
<input type="reset" class="form-input" value="{{ T("cancel")}}">
</form>
{{ if User.CurrentOrAdmin(UserProfile.ID) }}
<hr/>
<form method="POST" action="/user/{{UserProfile.ID}}/{{UserProfile.Username}}/delete" >
{{ yield csrf_field()}}
<button type="submit" class="form-input btn-red" onclick="if (!confirm('{{ T(" delete_account_confirm ") }}')) return false;" style="float:right">{{ T("delete_account") }}</button>
</form>
{{end}}
{{end}}