Files
website/public/js/login/registrieren.js

40 lines
1.3 KiB
JavaScript

function abschicken(){
let data = {};
data.mail = $("#mail").val();
data.username = $("#username").val();
data.password = $("#password").val();
data.token = $("#register_token").val();
if(data.password !== $("#password_repeat").val()) {
setzeFehlermeldung("failure", i18n.login.password_mismatch);
for(let i=0; i<Math.random() * 10; i++){
alert(i18n.login.password_mismatch);
}
} else {
$.ajax({
type: "POST",
url: "/intern/registrieren/abschicken",
data: data,
dataType: "json",
success: function(d){
switch(d.messageStatus){
case "success":
setzeFehlermeldung("success", i18n.login.registration_success)
break;
case "failure":
setzeFehlermeldung("failure", i18n.common.error_occurred + d.errorMessage);
break;
case "not permitted":
setzeFehlermeldung("failure", i18n.common.not_permitted);
break;
}
},
error: function(d, status, errorThrown) {
setzeFehlermeldung("failure", i18n.common.error_occurred + errorThrown);
}
});
}
}