Make sure php files can be used anywhere
This commit is contained in:
parent
c44d4eee3e
commit
ffdd008344
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('./config.php');
|
require_once(realpath(dirname(__FILE__) . '/./config.php'));
|
||||||
|
|
||||||
class Db {
|
class Db {
|
||||||
private $dbh;
|
private $dbh;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('./Db.php');
|
require_once(realpath(dirname(__FILE__) . '/./Db.php'));
|
||||||
require_once('./Token.php');
|
require_once(realpath(dirname(__FILE__) . '/./Token.php'));
|
||||||
|
|
||||||
class Dictionary {
|
class Dictionary {
|
||||||
private $db;
|
private $db;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../vendor/autoload.php');
|
require_once(realpath(dirname(__FILE__) . '/../vendor/autoload.php'));
|
||||||
|
|
||||||
use \Firebase\JWT\JWT;
|
use \Firebase\JWT\JWT;
|
||||||
use \Hashids\Hashids;
|
use \Hashids\Hashids;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('./Db.php');
|
require_once(realpath(dirname(__FILE__) . '/./Db.php'));
|
||||||
require_once('./Token.php');
|
require_once(realpath(dirname(__FILE__) . '/./Token.php'));
|
||||||
require_once('./Dictionary.php');
|
require_once(realpath(dirname(__FILE__) . '/./Dictionary.php'));
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
private $db;
|
private $db;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('./Response.php');
|
require_once(realpath(dirname(__FILE__) . '/./Response.php'));
|
||||||
require_once('./User.php');
|
require_once(realpath(dirname(__FILE__) . '/./User.php'));
|
||||||
|
|
||||||
$inputJSON = file_get_contents('php://input');
|
$inputJSON = file_get_contents('php://input');
|
||||||
$inputJSON = strip_tags($inputJSON);
|
$inputJSON = strip_tags($inputJSON);
|
||||||
|
@ -444,6 +444,32 @@ switch ($action) {
|
||||||
'error' => true,
|
'error' => true,
|
||||||
), 400);
|
), 400);
|
||||||
}
|
}
|
||||||
|
case 'password-reset': {
|
||||||
|
if (isset($request['code']) && isset($request['password'])) {
|
||||||
|
$user = new User();
|
||||||
|
$password_reset = $user->setPasswordReset($request['email']);
|
||||||
|
if ($password_reset === true) {
|
||||||
|
return Response::json(array(
|
||||||
|
'data' => $password_reset,
|
||||||
|
'error' => false,
|
||||||
|
), 200);
|
||||||
|
}
|
||||||
|
if (isset($password_reset['error'])) {
|
||||||
|
return Response::json(array(
|
||||||
|
'data' => $password_reset['error'],
|
||||||
|
'error' => true,
|
||||||
|
), 500);
|
||||||
|
}
|
||||||
|
return Response::json(array(
|
||||||
|
'data' => 'Could not send password reset key: email not found',
|
||||||
|
'error' => true,
|
||||||
|
), 401);
|
||||||
|
}
|
||||||
|
return Response::json(array(
|
||||||
|
'data' => 'Could not send password reset key: required data missing',
|
||||||
|
'error' => true,
|
||||||
|
), 400);
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
return Response::html('Hi!');
|
return Response::html('Hi!');
|
||||||
|
|
Loading…
Reference in New Issue