fixed missing user api

This commit is contained in:
Krehan Tim 2018-11-20 13:53:17 +01:00
parent 62294afa3b
commit a1e40f7902
5 changed files with 8 additions and 10 deletions

View file

@ -21,12 +21,14 @@
RewriteRule ^api/([\w-]+)/([\w-]+)$ php/api.php?site=api&call=$1&function=$2 [L]
</IfModule>
#Deny every *.php file
<Files *.php>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
#allow following files
<Files index.php>
Order Allow,Deny
Allow from all

View file

@ -1,13 +1,12 @@
$(document).ready(function(){
$("#button_newuser").click(function(){
$.post("/php/edit-user.php",
$.post("/api/user/new",
{
function: "new-user",
username: $("#text_user").val(),
passwd: $("#text_passwd").val()
},
function(data){
if(data==0){
if(data=="0"){
infoPopUp("Benutzer erfolgreich erstellt!", 100);
$("#text_user").val("");
$("#text_passwd").val("");

View file

@ -31,9 +31,8 @@ $(document).ready(function(){
}
});
$("#passwordSaveButton").click(function(){
$.post("/php/edit-user.php",
$.post("/api/user/change-pw",
{
function: "change-pw",
current: $("#old-password-input").val(),
new: $("#new-password-input").val()
},

View file

@ -13,6 +13,4 @@
<input id="button_newuser" class="button" type="submit" name="" value="Neuer Benutzer">
</div>
<button class="button button-disabled" id="adduser-button-done">Fertig</button>
<!-- Only here in install/adduser -->
<div id="info-popup"><font id="info-popup-text"></font></div>

View file

@ -1,16 +1,16 @@
<?php
include $_SESSION["docroot"].'/php/classes.user.php';
$user = new user;
if($_POST["function"]!="new-user"){
if($_GET["function"]!="new"){
$user->get_info($_COOKIE["token"]);
}
switch ($_GET["function"]) {
case 'change-pw':
$user->change_password($_POST["current"], $_POST["new"]);
break;
case 'new-user':
case 'new':
$user->new($_POST["username"], $_POST["passwd"]);
break;