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]
|
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
|
||||||
|
|
|
@ -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("");
|
||||||
|
|
|
@ -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()
|
||||||
},
|
},
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?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"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($_GET["function"]) {
|
switch ($_GET["function"]) {
|
||||||
case 'change-pw':
|
case 'change-pw':
|
||||||
$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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue