fix: add ids to buttons (#2186)

* fix: add ids to buttons

* fix: add ids to buttons

* fix:  fix name

* fix: button fixes
This commit is contained in:
Fabi 2021-08-13 12:10:48 +02:00 committed by GitHub
parent cdfdc69341
commit 677836f6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 16 deletions

View File

@ -32,8 +32,8 @@ type externalIDPCallbackData struct {
}
type externalNotFoundOptionFormData struct {
Link bool `schema:"link"`
AutoRegister bool `schema:"autoregister"`
Link bool `schema:"linkbutton"`
AutoRegister bool `schema:"autoregisterbutton"`
ResetLinking bool `schema:"resetlinking"`
TermsConfirm bool `schema:"terms-confirm"`
}

View File

@ -188,8 +188,8 @@ func CreateRenderer(pathPrefix string, staticDir http.FileSystem, staticStorage
"changeUsernameUrl": func() string {
return path.Join(r.pathPrefix, EndpointChangeUsername)
},
"externalNotFoundOptionUrl": func() string {
return path.Join(r.pathPrefix, EndpointExternalNotFoundOption)
"externalNotFoundOptionUrl": func(action string) string {
return path.Join(r.pathPrefix, EndpointExternalNotFoundOption+"?"+action+"=true")
},
"selectedLanguage": func(l string) bool {
return false

View File

@ -1,5 +1,10 @@
let button1 = document.getElementById("link-button");
disableSubmit(undefined, button1);
let buttons1 = document.getElementsByName("linkbutton");
let button2 = document.getElementById("auto-register-button");
disableSubmit(undefined, button2);
for (let i = 0; i < buttons1.length; i++) {
disableSubmit(undefined, buttons1[i]);
}
let buttons2 = document.getElementsByName("autoregisterbutton");
for (let i = 0; i < buttons2.length; i++) {
disableSubmit(undefined, buttons2[i]);
}

View File

@ -7,7 +7,7 @@
</div>
<form action="{{ externalNotFoundOptionUrl }}" method="POST">
<form action="{{ externalNotFoundOptionUrl "none" }}" method="POST">
{{ .CSRF }}
@ -18,9 +18,9 @@
<div class="lgn-field">
<label class="lgn-label">{{t "ExternalNotFoundOption.TosAndPrivacyLabel"}}</label>
<div class="lgn-checkbox">
<input type="checkbox" id="register-term-confirmation"
name="register-term-confirmation" required>
<label for="register-term-confirmation">
<input type="checkbox" id="terms-confirm"
name="terms-confirm" required>
<label for="terms-confirm">
{{t "ExternalNotFoundOption.TosConfirm"}}
{{ if .TOSLink }}
<a class="tos-link" target="_blank" href="{{ .TOSLink }}" rel="noopener noreferrer">
@ -49,16 +49,14 @@
<i class="lgn-icon-arrow-left-solid"></i>
</button>
<button class="lgn-raised-button lgn-primary" name="link" value="true">
<button type="submit" formaction="{{ externalNotFoundOptionUrl "linkbutton"}}" class="lgn-raised-button lgn-primary" name="linkbutton" value="true">
{{t "ExternalNotFoundOption.LinkButtonText"}}
</button>
<span class="fill-space"></span>
<button class="lgn-raised-button lgn-primary" name="autoregister" value="true">
<button type="submit" formaction="{{ externalNotFoundOptionUrl "autoregisterbutton"}}" class="lgn-raised-button lgn-primary" name="autoregisterbutton" value="true">
{{t "ExternalNotFoundOption.AutoRegisterButtonText"}}
</button>
</div>
{{template "error-message" .}}
</form>
<script src="{{ resourceUrl "scripts/form_submit.js" }}"></script>