75528da943
* Logout is now a posted form Instead of using a get method, I've moved it to a post method. Doing that made possible to use CSRF token and also fix #902 * Update _badgemenu.html
23 lignes
1,2 Kio
HTML
23 lignes
1,2 Kio
HTML
{{define "badge_user"}}
|
|
{{with .User}}
|
|
<div class="h-user">
|
|
{{if gt .ID 0}}
|
|
<button href="#" class="nav-btn">
|
|
<div class="user-avatar small"><img src="https://www.gravatar.com/avatar/{{ .MD5 }}?s=50"></div>
|
|
<span class="user-info" title="{{.Username}}"><span class="hide-md">{{.Username}}</span></span>
|
|
</button>
|
|
<div class="user-menu">
|
|
<a class="nav-btn" href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}">{{call $.T "profile"}}</a>
|
|
<a class="nav-btn" href="{{ genRoute "user_notifications" }}">{{ call $.T "my_notifications"}} <span class="badge">({{ .GetUnreadNotifications }})</span></a>
|
|
<a class="nav-btn" href="{{ genRoute "user_profile_edit" "id" (print .ID) "username" .Username }}">{{call $.T "settings"}}</a>
|
|
{{if HasAdmin . }}<a class="nav-btn" href="{{ genRoute "mod_index" }}">{{call $.T "moderation"}}</a>{{end}}
|
|
<form action="{{ genRoute "user_logout" }}" method="POST">{{ template "csrf_field" $ }}<input class="nav-btn" type="submit" name="logout" value="{{ call $.T "sign_out"}}"></form>
|
|
</div>
|
|
{{ else }}
|
|
<a href="{{ genRoute "user_login" }}" class="nav-btn">
|
|
{{ call $.T "signin" }}<span class="caret"></span>
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|