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/_profile_edit.html
akuma06 3ec367a759 CSRF Support + better key for context
* Added new dep: gorilla/csrf
* CSRF field in forms
* CSRF variable in commontemplatevariables
* New key for messages and user context

Please change EnableSecureCSRF to false when testing locally and don't
merge config/env.go with the changes
2017-05-29 17:07:18 +02:00

192 lignes
12 Kio
HTML
Brut Annotations Historique

Ce fichier contient des caractères Unicode ambigus.

Ce fichier contient des caractères Unicode qui peuvent être confondus avec d'autres caractères. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.

{{define "profile_edit_content"}}
{{with .UserProfile}}
{{ range (index $.FormInfos "infos")}}
<div class="alert alert-info"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-info-sign"></i> {{ . }}</div>
{{end}}
{{ range (index $.FormErrors "errors")}}
<div class="alert alert-danger"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-exclamation-sign"></i> {{ . }}</div>
{{end}}
<h3>{{ call $.T "personal_info"}}</h3>
<div class="user-edit">
<form role="form" method="POST">
{{ block "csrf_field" $ }}{{end}}
<label class="input-label">{{call $.T "api_token" }}:</label>
<p style="font-family: monospace;">{{.APIToken}}</p>
<a class="form-input up-input" href="{{ genRoute "user_profile_apireset" "id" (print .ID) "username" .Username }}">Reset Api key</a> <br> <br>
<label class="input-label">{{ call $.T "email_address" }}:</label> <br>
<input class="form-input up-input" type="text" name="email" id="email" value="{{.Email}}"> <br>
{{ range (index $.FormErrors "email")}}
<p class="text-error">{{ . }}</p>
{{end}}
<label class="input-label">{{ call $.T "language"}}:</label> <br>
<select id="language" name="language" class="form-input up-input">
{{ $userLanguage := .Language }}
{{ range $tag, $translatedName := $.Languages }}
<option value="{{ $tag }}" {{ if or (eq $userLanguage $tag) (and (eq $userLanguage "") (eq $tag getDefaultLanguage)) }}selected{{end}}>{{ $translatedName }} {{if eq $tag getDefaultLanguage}}({{ call $.T "default" }}){{end}}</option>
{{ end }}
</select> <br>
{{ range (index $.FormErrors "language")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{ if not (HasAdmin $.User)}}
<label class="input-label">{{ call $.T "current_password"}}:</label> <br>
<input class="form-input up-input up-input" name="current_password" id="current_password" type="password"> <br>
{{ range (index $.FormErrors "current_password")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
<label class="input-label">{{ call $.T "password"}}:</label> <br>
<input class="form-input up-input up-input" name="password" id="password" type="password"> <br>
{{ range (index $.FormErrors "password")}}
<p class="text-error">{{ . }}</p>
{{end}}
<label class="input-label">{{ call $.T "confirm_password"}}:</label> <br>
<input class="form-input up-input up-input" name="password_confirmation" id="password_confirmation" type="password"> <br>
{{ range (index $.FormErrors "password_confirmation")}}
<p class="text-error">{{ . }}</p>
{{end}}
<h3>{{ call $.T "preferences"}}</h3>
<label class="input-label" for="theme">{{call $.T "theme"}}</label> <br>
<select id="theme-selector" name="theme" class="form-input up-input" onchange="switchThemes()">
<option value="">{{call $.T "theme_select"}}</option>
<option value="g"{{ if eq $.Theme "g" }} selected{{end}}>/g/</option>
<option value="tomorrow"{{ if eq $.Theme "tomorrow" }} selected{{end}}>Tomorrow</option>
<option value=""{{ if eq $.Theme "" }} selected{{end}}>{{call $.T "theme_none"}}</option>
</select><br>
{{ range (index $.FormErrors "theme")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{ with .Settings }}
{{ if DefaultUserSettings "new_torrent"}}
<label class="input-label">{{ call $.T "new_torrent_settings" }}:</label> <br>
<select id="new_torrent" name="new_torrent" class="form-input up-input">
<option value="0" {{ if not (.Get "new_torrent") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_torrent" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_torrent")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_torrent_email"}}
<label class="input-label">{{ call $.T "new_torrent_email_settings" }}:</label> <br>
<select id="new_torrent_email" name="new_torrent_email" class="form-input up-input">
<option value="0" {{ if not (.Get "new_torrent_email") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_torrent_email"}}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_torrent_email")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_comment"}}
<label class="input-label">{{ call $.T "new_comment_settings" }}:</label> <br>
<select id="new_comment" name="new_comment" class="form-input up-input">
<option value="0" {{ if not (.Get "new_comment") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_comment" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_comment")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_comment_email"}}
<label class="input-label">{{ call $.T "new_comment_email_settings" }}:</label> <br>
<select id="new_comment_email" name="new_comment_email" class="form-input up-input">
<option value="0" {{ if not (.Get "new_comment_email") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_comment_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_comment_email")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_responses"}}
<label class="input-label">{{ call $.T "new_responses_settings" }}:</label> <br>
<select id="new_responses" name="new_responses" class="form-input up-input">
<option value="0" {{ if not (.Get "new_responses") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_responses" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_responses")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_responses_email"}}
<label class="input-label">{{ call $.T "new_responses_email_settings" }}:</label> <br>
<select id="new_responses_email" name="new_responses_email" class="form-input up-input">
<option value="0" {{ if not (.Get "new_responses_email") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_responses_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_responses_email")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_follower"}}
<label class="input-label">{{ call $.T "new_follower_settings" }}:</label> <br>
<select id="new_follower" name="new_follower" class="form-input up-input">
<option value="0" {{ if not (.Get "new_follower") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_follower" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_follower")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "new_follower_email"}}
<label class="input-label">{{ call $.T "new_follower_email_settings" }}:</label> <br>
<select id="new_follower_email" name="new_follower_email" class="form-input up-input">
<option value="0" {{ if not (.Get "new_follower_email") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "new_follower_email"}}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "new_follower_email")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "followed"}}
<label class="input-label">{{ call $.T "followed_settings" }}:</label> <br>
<select id="followed" name="followed" class="form-input up-input">
<option value="0" {{ if not (.Get "followed") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "followed" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select><br>
{{ range (index $.FormErrors "followed")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{ if DefaultUserSettings "followed_email"}}
<label class="input-label">{{ call $.T "followed_email_settings" }}:</label> <br>
<select id="followed_email" name="followed_email" class="form-input up-input">
<option value="0" {{ if not (.Get "followed_email") }}selected{{end}}>{{ call $.T "no"}}</option>
<option value="1" {{ if .Get "followed_email" }}selected{{end}}>{{ call $.T "yes"}}</option>
</select> <br>
{{ range (index $.FormErrors "followed_email")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
{{end}}
{{ if HasAdmin $.User}}
<h3>{{ call $.T "moderation"}}</h3>
<label class="input-label">{{ call $.T "username"}}:</label> <br>
<input class="form-input up-input" name="username" id="username" type="text" value="{{.Username}}">
{{ range (index $.FormErrors "username")}}
<p class="text-error">{{ . }}</p>
{{end}}
<label class="input-label">{{ call $.T "role" }}:</label>
<select id="status" name="status" class="form-input up-input">
<option value="-1" {{ if eq .Status -1 }}selected{{end}}>{{ call $.T "banned"}}</option>
<option value="0" {{ if eq .Status 0 }}selected{{end}}>{{ call $.T "member"}} ({{ call $.T "default" }})</option>
<option value="1" {{ if eq .Status 1 }}selected{{end}}>{{ call $.T "trusted_member"}}</option>
{{ if eq .Status 2 }} <!-- just so that it shows correctly -->
<option value="2" selected>{{ call $.T "moderator"}}</option>
{{end}}
</select>
{{ range (index $.FormErrors "status")}}
<p class="text-error">{{ . }}</p>
{{end}}
{{end}}
<label class="input-label"></label>
<input type="submit" class="form-input" name="save" value="{{ call $.T "save_changes"}}">
<span></span>
<input type="reset" class="form-input" value="{{ call $.T "cancel"}}">
</form>
</div>
{{ if CurrentOrAdmin $.User .ID }}
<hr>
<a href="{{ genRoute "user_profile" }}?delete" onclick="if (!confirm('{{ call $.T "delete_account_confirm" }}')) return false;" class="btn btn-danger btn-lg"><i class="glyphicon glyphicon-trash"></i> {{ call $.T "delete_account"}}</a>
{{end}}
{{end}}
{{end}}