Show CLA error (#25496)

This commit is contained in:
Joakim Sørensen 2023-01-02 10:40:18 +01:00 committed by GitHub
parent aee819b682
commit d4e43a995d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,12 +29,20 @@ description: "The Home Assistant contributor license agreement (CLA) signature p
#complete { #complete {
display: none; display: none;
} }
#error {
background: red;
color: white;
padding: 4px;
display: none;
}
</style> </style>
<div id="loading"> <div id="loading">
<div id="spinner"></div> <div id="spinner"></div>
<p>Please wait while we complete authentication and load data from GitHub...</p> <p>Please wait while we complete authentication and load data from GitHub...</p>
</div> </div>
<div id="error"></div>
<form action="#" id="signature_form"> <form action="#" id="signature_form">
<div class="wrapper"> <div class="wrapper">
@ -454,6 +462,7 @@ description: "The Home Assistant contributor license agreement (CLA) signature p
} }
}); });
$('#submit').click(function(e){ $('#submit').click(function(e){
const errorEl = document.querySelector("#error")
if ($('form')[0].checkValidity()) { if ($('form')[0].checkValidity()) {
e.preventDefault(); e.preventDefault();
var payload = { var payload = {
@ -489,6 +498,10 @@ description: "The Home Assistant contributor license agreement (CLA) signature p
} }
localStorage.removeItem("pr"); localStorage.removeItem("pr");
localStorage.removeItem("gh_token"); localStorage.removeItem("gh_token");
errorEl.style.display = "none"
}).fail(function(data){
errorEl.textContent = data.responseJSON.message;
errorEl.style.display = "block"
}); });
} }
}); });