diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-02-27 16:00:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 16:00:13 -0600 |
commit | 15fbf509d3475cef3f8a7e994b59e4d78fd1c508 (patch) | |
tree | 86b8f7bca92f3d6d235b07e0962fe6443711398d /templates | |
parent | 90919bb37e2bcc62440e393439825fe0e1e1f343 (diff) | |
download | gitea-15fbf509d3475cef3f8a7e994b59e4d78fd1c508.tar.gz gitea-15fbf509d3475cef3f8a7e994b59e4d78fd1c508.zip |
Org action fixes and form cleanup (#10512)
* More org fixes
* Move form action query to inputs
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/org/member/members.tmpl | 10 | ||||
-rw-r--r-- | templates/org/team/members.tmpl | 4 | ||||
-rw-r--r-- | templates/org/team/repositories.tmpl | 4 | ||||
-rw-r--r-- | templates/org/team/sidebar.tmpl | 10 | ||||
-rw-r--r-- | templates/org/team/teams.tmpl | 8 | ||||
-rw-r--r-- | templates/user/settings/organization.tmpl | 5 |
6 files changed, 26 insertions, 15 deletions
diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 15af60d573..1a65a02278 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -54,9 +54,15 @@ <div class="ui four wide column"> <div class="text right"> {{if eq $.SignedUser.ID .ID}} - <a class="ui red small button" href="{{$.OrgLink}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a> + <form method="post" action="{{$.OrgLink}}/members/action/leave"> + {{$.CsrfTokenHtml}} + <button type="submit" class="ui red small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.leave"}}</button> + </form> {{else if $.IsOrganizationOwner}} - <a class="ui red small button" href="{{$.OrgLink}}/members/action/remove?uid={{.ID}}">{{$.i18n.Tr "org.members.remove"}}</a> + <form method="post" action="{{$.OrgLink}}/members/action/remove"> + {{$.CsrfTokenHtml}} + <button type="submit" class="ui red small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.remove"}}</button> + </form> {{end}} </div> </div> diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index f3b08652cd..ef595f841a 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -27,9 +27,9 @@ {{range .Team.Members}} <div class="item"> {{if $.IsOrganizationOwner}} - <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove?uid={{.ID}}"> + <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui red small button right" >{{$.i18n.Tr "org.members.remove"}}</button> + <button type="submit" class="ui red small button right" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.remove"}}</button> </form> {{end}} <a href="{{.HomeLink}}"> diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index d6046f86a3..e3c52e1615 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -35,9 +35,9 @@ {{range .Team.Repos}} <div class="item"> {{if $canAddRemove}} - <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove?repoid={{.ID}}"> + <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui red small button right">{{$.i18n.Tr "remove"}}</button> + <button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.i18n.Tr "remove"}}</button> </form> {{end}} <a class="member" href="{{AppSubUrl}}/{{$.Org.Name}}/{{.Name}}"> diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index ff2474f007..d3bd082875 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -3,14 +3,16 @@ <strong>{{.Team.Name}}</strong> <div class="ui right"> {{if .Team.IsMember $.SignedUser.ID}} - <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.SignedUser.ID}}&page=home"> + <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui red tiny button">{{$.i18n.Tr "org.teams.leave"}}</button> + <input type="hidden" name="page" value="home"/> + <button type="submit" class="ui red tiny button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</button> </form> {{else if .IsOrganizationOwner}} - <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join?uid={{$.SignedUser.ID}}&page=team"> + <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui blue tiny button">{{$.i18n.Tr "org.teams.join"}}</button> + <input type="hidden" name="page" value="team"/> + <button type="submit" class="ui blue tiny button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</button> </form> {{end}} </div> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index a042ef6112..6aef18dfff 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -17,14 +17,14 @@ <a class="text black" href="{{$.OrgLink}}/teams/{{.LowerName}}"><strong>{{.Name}}</strong></a> <div class="ui right"> {{if .IsMember $.SignedUser.ID}} - <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave?uid={{$.SignedUser.ID}}"> + <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui red small button">{{$.i18n.Tr "org.teams.leave"}}</button> + <button type="submit" class="ui red small button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</button> </form> {{else if $.IsOrganizationOwner}} - <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/join?uid={{$.SignedUser.ID}}"> + <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/join"> {{$.CsrfTokenHtml}} - <button type="submit" class="ui blue small button">{{$.i18n.Tr "org.teams.join"}}</button> + <button type="submit" class="ui blue small button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</button> </form> {{end}} </div> diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl index e746400a8f..00b73f94d9 100644 --- a/templates/user/settings/organization.tmpl +++ b/templates/user/settings/organization.tmpl @@ -17,7 +17,10 @@ {{range .Orgs}} <div class="item"> <div class="right floated content"> - <a class="ui blue small button" href="{{AppSubUrl}}/org/{{.Name}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a> + <form method="post" action="{{AppSubUrl}}/org/{{.Name}}/members/action/leave"> + {{$.CsrfTokenHtml}} + <button type="submit" class="ui blue small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.leave"}}</button> + </form> </div> <img class="ui mini image" src="{{.RelAvatarLink}}"> <div class="content"> |