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

View file

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

View file

@ -31,9 +31,8 @@ $(document).ready(function(){
} }
}); });
$("#passwordSaveButton").click(function(){ $("#passwordSaveButton").click(function(){
$.post("/php/edit-user.php", $.post("/api/user/change-pw",
{ {
function: "change-pw",
current: $("#old-password-input").val(), current: $("#old-password-input").val(),
new: $("#new-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"> <input id="button_newuser" class="button" type="submit" name="" value="Neuer Benutzer">
</div> </div>
<button class="button button-disabled" id="adduser-button-done">Fertig</button> <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> <div id="info-popup"><font id="info-popup-text"></font></div>

View file

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