fix links to prevent 404 after e.g. submitting a faulty form (#3982)

tokarchuk/v1.17
David Schneiderbauer 7 years ago committed by techknowlogick
parent b574af27b8
commit 0857e289d5
  1. 10
      templates/user/settings/account.tmpl
  2. 2
      templates/user/settings/security_accountlinks.tmpl
  3. 6
      templates/user/settings/security_openid.tmpl
  4. 6
      templates/user/settings/security_twofa.tmpl

@ -8,7 +8,7 @@
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
{{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}}
<form class="ui form" action="{{.Link}}?tp=password" method="post"> <form class="ui form" action="{{AppSubUrl}}/user/settings/account" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
{{if .SignedUser.IsPasswordSet}} {{if .SignedUser.IsPasswordSet}}
<div class="required field {{if .Err_OldPassword}}error{{end}}"> <div class="required field {{if .Err_OldPassword}}error{{end}}">
@ -49,13 +49,13 @@
<div class="item"> <div class="item">
{{if not .IsPrimary}} {{if not .IsPrimary}}
<div class="right floated content"> <div class="right floated content">
<button class="ui red tiny button delete-button" id="delete-email" data-url="{{$.Link}}/email/delete" data-id="{{.ID}}"> <button class="ui red tiny button delete-button" id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_email"}} {{$.i18n.Tr "settings.delete_email"}}
</button> </button>
</div> </div>
{{if .IsActivated}} {{if .IsActivated}}
<div class="right floated content"> <div class="right floated content">
<form action="{{$.Link}}/email" method="post"> <form action="{{AppSubUrl}}/user/settings/account/email" method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input name="_method" type="hidden" value="PRIMARY"> <input name="_method" type="hidden" value="PRIMARY">
<input name="id" type="hidden" value="{{.ID}}"> <input name="id" type="hidden" value="{{.ID}}">
@ -73,7 +73,7 @@
</div> </div>
</div> </div>
<div class="ui attached bottom segment"> <div class="ui attached bottom segment">
<form class="ui form" action="{{.Link}}/email" method="post"> <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_Email}}error{{end}}"> <div class="required field {{if .Err_Email}}error{{end}}">
<label for="email">{{.i18n.Tr "settings.add_new_email"}}</label> <label for="email">{{.i18n.Tr "settings.add_new_email"}}</label>
@ -92,7 +92,7 @@
<div class="ui red message"> <div class="ui red message">
<p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p> <p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
</div> </div>
<form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}/delete" method="post"> <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input class="fake" type="password"> <input class="fake" type="password">
<div class="required field {{if .Err_Password}}error{{end}}"> <div class="required field {{if .Err_Password}}error{{end}}">

@ -10,7 +10,7 @@
{{range $loginSource, $provider := .AccountLinks}} {{range $loginSource, $provider := .AccountLinks}}
<div class="item"> <div class="item">
<div class="right floated content"> <div class="right floated content">
<button class="ui red tiny button delete-button" id="delete-account-link" data-url="{{$.Link}}/account_link" data-id="{{$loginSource.ID}}"> <button class="ui red tiny button delete-button" id="delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link" data-id="{{$loginSource.ID}}">
{{$.i18n.Tr "settings.delete_key"}} {{$.i18n.Tr "settings.delete_key"}}
</button> </button>
</div> </div>

@ -9,12 +9,12 @@
{{range .OpenIDs}} {{range .OpenIDs}}
<div class="item"> <div class="item">
<div class="right floated content"> <div class="right floated content">
<button class="ui red tiny button delete-button" id="delete-openid" data-url="{{$.Link}}/openid/delete" data-id="{{.ID}}"> <button class="ui red tiny button delete-button" id="delete-openid" data-url="{{AppSubUrl}}/user/settings/security/openid/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_key"}} {{$.i18n.Tr "settings.delete_key"}}
</button> </button>
</div> </div>
<div class="right floated content"> <div class="right floated content">
<form action="{{$.Link}}/openid/toggle_visibility" method="post"> <form action="{{AppSubUrl}}/user/settings/security/openid/toggle_visibility" method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input name="id" type="hidden" value="{{.ID}}"> <input name="id" type="hidden" value="{{.ID}}">
{{if .Show}} {{if .Show}}
@ -39,7 +39,7 @@
</div> </div>
</div> </div>
<div class="ui attached bottom segment"> <div class="ui attached bottom segment">
<form class="ui form" action="{{.Link}}/openid" method="post"> <form class="ui form" action="{{AppSubUrl}}/user/settings/security/openid" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_OpenID}}error{{end}}"> <div class="required field {{if .Err_OpenID}}error{{end}}">
<label for="openid">{{.i18n.Tr "settings.add_new_openid"}}</label> <label for="openid">{{.i18n.Tr "settings.add_new_openid"}}</label>

@ -5,12 +5,12 @@
<p>{{.i18n.Tr "settings.twofa_desc"}}</p> <p>{{.i18n.Tr "settings.twofa_desc"}}</p>
{{if .TwofaEnrolled}} {{if .TwofaEnrolled}}
<p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p> <p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p>
<form class="ui form" action="{{.Link}}/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data"> <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p> <p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p>
<button class="ui blue button">{{$.i18n.Tr "settings.twofa_scratch_token_regenerate"}}</button> <button class="ui blue button">{{$.i18n.Tr "settings.twofa_scratch_token_regenerate"}}</button>
</form> </form>
<form class="ui form" action="{{.Link}}/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form"> <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<p>{{.i18n.Tr "settings.twofa_disable_note"}}</p> <p>{{.i18n.Tr "settings.twofa_disable_note"}}</p>
<div class="ui red button delete-button" id="disable-twofa" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div> <div class="ui red button delete-button" id="disable-twofa" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div>
@ -18,7 +18,7 @@
{{else}} {{else}}
<p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p> <p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p>
<div class="inline field"> <div class="inline field">
<a class="ui green button" href="{{.Link}}/two_factor/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a> <a class="ui green button" href="{{AppSubUrl}}/user/settings/security/two_factor/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>

Loading…
Cancel
Save