mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
fixed missing user api
This commit is contained in:
parent
62294afa3b
commit
a1e40f7902
5 changed files with 8 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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("");
|
||||
|
|
|
@ -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()
|
||||
},
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue