add more registration stuff, admin interface

This commit is contained in:
TuxCoder 2020-06-01 23:43:10 +02:00
parent c1c8876b63
commit 67b69104d6
23 changed files with 369 additions and 92 deletions

View file

@ -47,6 +47,54 @@ window.$(document).ready(function () {
};
});
window.admin = {
registration: {
delete: function(href, registration_id, username) {
var dialog = new ConfirmDialog('Reject user registration', `Are you sure to reject the registration request from "${username}"?`);
dialog.show().then(()=>{
fetch(href, {
method: 'DELETE'
});
});
return false;
},
accept: function(href, registration_id, username) {
var dialog = new ConfirmDialog('Accept user registration', `Are you sure to accept the registration request from "${username}"?`);
dialog.show().then(()=>{
fetch(href, {
method: 'PUT'
});
});
return false;
}
}
};
window.auth = {
sign_up: {
submit: function(form) {
SimpleFormSubmit.submitForm(form.action, form)
.then(response =>{
response.json().then(function(data) {
if (data.errors) {
var msg ='<ul>';
for( var field in data.errors) {
msg += `<li>${field}: ${data.errors[field]}</li>`;
}
msg += '</ul>';
new Dialog('Registration Error', `Error Happend: ${msg}`).show()
} else {
new Dialog('Registration successfully', 'Wait until an administrator has aproved your account').show();
}
});
});
return false;
}
}
};
window.totp = {
init_list: function(){
},

View file

@ -10,6 +10,10 @@
width: 100%;
margin-top: 30px;
z-index: 500;
}
nav.sidebar {
top: 44px;
}