Kennwortwechsel Benutzer anlegen
This commit is contained in:
32
js/components/admin_changepwd.js
Normal file
32
js/components/admin_changepwd.js
Normal file
@ -0,0 +1,32 @@
|
||||
function changepwd(){
|
||||
var password = document.getElementById("password").value;
|
||||
var password_new1 = document.getElementById("password_new1").value;
|
||||
var password_new2 = document.getElementById("password_new2").value;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../controller/admin_changepwd.php',
|
||||
data: {
|
||||
'function': 'changepwd',
|
||||
'password': password,
|
||||
'password_new1': password_new1,
|
||||
'password_new2': password_new2
|
||||
},
|
||||
success: function(result) { //we got the response
|
||||
if(result!=''){
|
||||
var a = result.split('|***|');
|
||||
if(a[1]=="success"){
|
||||
document.getElementById("password").value ="";
|
||||
document.getElementById("password_new1").value ="";
|
||||
document.getElementById("password_new2").value ="";
|
||||
|
||||
}
|
||||
$('#msg').show().delay(10000).fadeOut(500);
|
||||
$('#msg').html(a[0]);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, exception) {
|
||||
console.log(xhr);
|
||||
}
|
||||
});
|
||||
}
|
62
js/components/admin_create_user.js
Normal file
62
js/components/admin_create_user.js
Normal file
@ -0,0 +1,62 @@
|
||||
function checkUser(){
|
||||
var mail = document.getElementById("mail").value;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../controller/admin_create_user.php',
|
||||
data: {
|
||||
'function': 'checkuser',
|
||||
'mail': mail
|
||||
},
|
||||
success: function(result) { //we got the response
|
||||
if(result!=''){
|
||||
$('#msg').show().delay(5000).fadeOut(500);
|
||||
$('#msg').html(result);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, exception) {
|
||||
console.log(xhr);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function usersave(){
|
||||
var vorname = document.getElementById("vorname").value;
|
||||
var nachname = document.getElementById("nachname").value;
|
||||
var mail = document.getElementById("mail").value;
|
||||
//var my_data = $("form").serialize();
|
||||
|
||||
//komma getrennte Werte bei Mehrfachauswahl
|
||||
var rollen = $("#rollen").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '../controller/admin_create_user.php',
|
||||
data: {
|
||||
'function': 'usersave',
|
||||
'vorname': vorname,
|
||||
'nachname': nachname,
|
||||
'mail': mail,
|
||||
'rollen': rollen
|
||||
},
|
||||
success: function(result) { //we got the response
|
||||
if(result!=''){
|
||||
var a = result.split('|***|');
|
||||
if(a[1]=="success"){
|
||||
document.getElementById("vorname").value ="";
|
||||
document.getElementById("nachname").value ="";
|
||||
document.getElementById("mail").value ="";
|
||||
var elements = document.getElementById("rollen").options;
|
||||
for(var i = 0; i < elements.length; i++){
|
||||
elements[i].selected = false;
|
||||
}
|
||||
}
|
||||
$('#msg1').show().delay(10000).fadeOut(500);
|
||||
$('#msg1').html(a[0]);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, exception) {
|
||||
console.log(xhr);
|
||||
}
|
||||
});
|
||||
}
|
23
js/show-password-toggle.js
Normal file
23
js/show-password-toggle.js
Normal file
@ -0,0 +1,23 @@
|
||||
var ShowPasswordToggle = document.querySelector("[type='password']");
|
||||
ShowPasswordToggle.onclick = function () {
|
||||
document.querySelector("[type='password']").classList.add("input-password");
|
||||
document.getElementById("toggle-password").classList.remove("d-none");
|
||||
|
||||
const passwordInput = document.querySelector("[type='password']");
|
||||
const togglePasswordButton = document.getElementById("toggle-password");
|
||||
|
||||
togglePasswordButton.addEventListener("click", togglePassword);
|
||||
function togglePassword() {
|
||||
if (passwordInput.type === "password") {
|
||||
passwordInput.type = "text";
|
||||
togglePasswordButton.setAttribute("aria-label", "Hide password.");
|
||||
} else {
|
||||
passwordInput.type = "password";
|
||||
togglePasswordButton.setAttribute(
|
||||
"aria-label",
|
||||
"Show password as plain text. " +
|
||||
"Warning: this will display your password on the screen."
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user