Bug Fixing

This commit is contained in:
Chris Mann 2023-07-27 12:57:02 +02:00
parent a04431032a
commit 47c96daf53

View file

@ -66,7 +66,8 @@
{{end}} {{end}}
<div class="form-group"> <div class="form-group">
<label for="defaultdomain">Domain au sein des GV:</label> <label for="defaultdomain">Domain au sein des GV:</label>
<input type="text" id="defaultdomain" name="defaultdomain" class="form-control" value="{{ .NewUserDefaultDomain }}" /> <input type="text" id="defaultdomain" name="defaultdomain" class="form-control"
value="{{ .NewUserDefaultDomain }}" />
<small class="form-text text-muted"> <small class="form-text text-muted">
Le domaine du courriel des GV pour le nouveau utilisateur Le domaine du courriel des GV pour le nouveau utilisateur
</small> </small>
@ -101,56 +102,54 @@
Les deux mots de passe entrés ne correspondent pas. Les deux mots de passe entrés ne correspondent pas.
</div> </div>
{{end}} {{end}}
<button type="submit" class="btn btn-primary" onClick="ValidateEmail(document.getElementById('othermailbox'))">Créer le compte</button> <button type="submit" class="btn btn-primary" onClick="ValidateEmail(document.getElementById('othermailbox'))">Créer
le compte</button>
</form> </form>
<script lang="javascript"> <script lang="javascript">
function ValidateEmail(inputControl) function ValidateEmail(inputControl) {
{ var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if (inputControl.value.match(mailformat)) {
if(inputText.value.match(mailformat)) alert("Merci de renseigner un courriel de secours svp");
{ inputControl.focus();
alert("Merci de renseigner un courriel de secours svp"); return true;
inputControl.focus(); }
return true; else {
} alert("Merci de renseigner un courriel de secours svp");
else inputControl.focus();
{ return false;
alert("Merci de renseigner un courriel de secours svp"); }
inputControl.focus(); }
return false;
}
}
function changeGivenNameOrSurname () { function changeGivenNameOrSurname() {
givenname = document.getElementById("givenname"); givenname = document.getElementById("givenname");
surname = document.getElementById("surname"); surname = document.getElementById("surname");
displayname = document.getElementById("displayname"); displayname = document.getElementById("displayname");
displayname.value = givenname.value + " " + surname.value displayname.value = givenname.value + " " + surname.value
changeDisplayname(); changeDisplayname();
} }
function changeDisplayname () { function changeDisplayname() {
displayname = document.getElementById("displayname"); displayname = document.getElementById("displayname");
username = document.getElementById("username"); username = document.getElementById("username");
username.value = displayname.value.toLowerCase().replace(/[^A-z0-9.-]/g, '').replace(/^[.-]/, '').replace(/[.-]$/, ''); username.value = displayname.value.toLowerCase().replace(/[^A-z0-9.-]/g, '').replace(/^[.-]/, '').replace(/[.-]$/, '');
changeUsername(); changeUsername();
} }
function changeUsername () { function changeUsername() {
changeDomain(); changeDomain();
} }
function changeDomain () { function changeDomain() {
username = document.getElementById("username"); username = document.getElementById("username");
defaultdomain = document.getElementById("defaultdomain"); defaultdomain = document.getElementById("defaultdomain");
mail = document.getElementById("mail"); mail = document.getElementById("mail");
mail.value = username.value + "@" + defaultdomain.value; mail.value = username.value + "@" + defaultdomain.value;
} }
document.getElementById("givenname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("givenname").addEventListener("change", changeGivenNameOrSurname);
document.getElementById("surname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("surname").addEventListener("change", changeGivenNameOrSurname);
document.getElementById("displayname").addEventListener("change",changeDisplayname); document.getElementById("displayname").addEventListener("change", changeDisplayname);
document.getElementById("username").addEventListener("change",changeUsername); document.getElementById("username").addEventListener("change", changeUsername);
document.getElementById("defaultdomain").addEventListener("change",changeDomain); document.getElementById("defaultdomain").addEventListener("change", changeDomain);
</script> </script>
{{end}} {{end}}
{{end}} {{end}}