This commit is contained in:
Kekskurse 2019-04-25 17:33:15 +02:00
parent 0d033078e7
commit 0d929748b7
16 changed files with 614 additions and 124 deletions

View file

@ -0,0 +1,9 @@
<?php
namespace App\Exceptions;
class NoPermissionException extends HTTPException
{
public function __construct($httpCode = 403, $message = "You need to login", $code = 0, Exception $previous = null) {
parent::__construct($httpCode, $message, $code, $previous);
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace App\Exceptions;
class NotLoggedInException extends HTTPException
{
public function __construct($httpCode = 401, $message = "You need to login", $code = 0, Exception $previous = null) {
parent::__construct($httpCode, $message, $code, $previous);
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace App\Exceptions;
class ResourceNotFound extends HTTPException
{
public function __construct($httpCode = 404, $message = "Resource not Found", $code = 0, Exception $previous = null) {
parent::__construct($httpCode, $message, $code, $previous);
}
}

View file

@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\API;
use App\Exceptions\NoPermissionException;
use App\Exceptions\NotLoggedInException;
use App\Exceptions\ResourceNotFound;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Laravel\Lumen\Routing\Controller as BaseController;
use TaGeSo\APIResponse\Response;
class AccountController extends BaseController
{
public function getUsers(Response $response) {
if(!Auth::check()) {
throw new NotLoggedInException();
}
if(!Auth::user()->admin) {
throw new NoPermissionException();
}
$users = User::query()->paginate(100);
$response->setPagination(
$users->currentPage(),
$users->lastPage(),
$users->perPage()
);
return $response->withData(\App\Http\Resources\API\User::collection(($users)));
}
public function getUser(Response $response, $id) {
if(!Auth::check()) {
throw new NotLoggedInException();
}
if(!(Auth::user()->admin || Auth::user()->id == $id)) {
throw new NoPermissionException();
}
$user = User::query()->where("id", "=", $id)->first();
if($user == null) {
throw new ResourceNotFound();
}
return $response->withData(new \App\Http\Resources\API\User($user));
}
}

View file

@ -0,0 +1,61 @@
<?php
namespace App\Http\Controllers\GUI;
use App\Exceptions\HTTPException;
use App\Http\Controllers\Controller;
use App\Http\Resources\oAuth\AccessToken;
use App\Jobs\Mails\ValidateMailAddressJob;
use App\Models\App;
use App\Models\AppAccess;
use App\Models\AppCode;
use App\Models\Invite;
use App\Models\Mail;
use App\Models\RefreshToken;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class AccessController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
public function listAccess() {
if(!Auth::check()) {
abort(401);
}
$access = AppAccess::query()->where("user_id", "=", Auth::user()->id)->get();
return view("access/list", ["access" => $access]);
}
public function removeAccess(Request $request) {
if(!Auth::check()) {
abort(401);
}
$access = AppAccess::query()->where("id", "=", $request->id)->firstOrFail();
if($access->user_id != Auth::user()->id) {
abort(401);
}
RefreshToken::query()->where("access_id", "=", $access->id)->delete();
\App\Models\AccessToken::query()->where("access_id", "=", $access->id)->delete();
AppCode::query()->where("access_id", "=", $access->id)->delete();
$access->delete();
return redirect("/gui/access");
}
}

View file

@ -13,6 +13,7 @@ use App\Models\Mail;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class AccountController extends Controller class AccountController extends Controller
@ -73,6 +74,10 @@ class AccountController extends Controller
$user->username = $request->input("username"); $user->username = $request->input("username");
$user->password = password_hash($request->input("password"), PASSWORD_BCRYPT); $user->password = password_hash($request->input("password"), PASSWORD_BCRYPT);
if($invite != null) {
$user->inviteCode = $invite->code;
}
//Make first user an admin //Make first user an admin
$count = User::query()->count("*"); $count = User::query()->count("*");
if($count == 1) { if($count == 1) {
@ -142,16 +147,114 @@ class AccountController extends Controller
} }
$mail->status = "valide"; $mail->status = "valide";
$mail->primary = true;
$mails = Mail::query()->where("user_id", "=", $mail->user_id)->where("primary", "=", true)->get("*"); $user = User::query()->where("id", "=", $mail->user_id)->firstOrFail();
if($user->getMail() == null) {
$mail->primary = true;
}
//Dont set new Mails as primary
/*$mails = Mail::query()->where("user_id", "=", $mail->user_id)->where("primary", "=", true)->get("*");
foreach($mails as $m) {
$m->primary = false;
$m->saveOrFail();
}*/
$mail->saveOrFail();
echo "E-Mail wurde validiert";
}
public function profileView() {
if(!Auth::check()) {
abort(401);
}
$mails = Mail::query()->where("user_id", "=", Auth::user()->id)->get();
return view('account/profile', ["mails" => $mails]);
}
public function addMail(Request $request) {
if(!Auth::check()) {
abort(401);
}
$this->validate($request, [
'mail' => 'required|email|unique:mails'
]);
$mail = new Mail();
$mail->createValidationToken();
$mail->mail = $request->input("mail");
$mail->primary = false;
$mail->status = "waiting";
$mail->user_id = Auth::user()->id;
$mail->saveOrFail();
$this->dispatch(new ValidateMailAddressJob($mail));
return redirect("/gui/profile");
}
public function changePrimaryMail(Request $request) {
if(!Auth::check()) {
abort(401);
}
$mail = Mail::query()->where("id", "=", $request->input("mail"))->firstOrFail();
if($mail->user_id != Auth::user()->id) {
abort(401);
}
if($mail->status != "valide") {
return "Mail not valide";
}
$mails = Mail::query()->where("user_id", "=", Auth::user()->id)->get();
foreach($mails as $m) { foreach($mails as $m) {
$m->primary = false; $m->primary = false;
$m->saveOrFail(); $m->saveOrFail();
} }
$mail->primary = true;
$mail->saveOrFail(); $mail->saveOrFail();
echo "E-Mail wurde validiert";
return redirect("/gui/profile");
}
public function removeMail(Request $request) {
if(!Auth::check()) {
abort(401);
}
$mail = Mail::query()->where("id", "=", $request->input("mail"))->firstOrFail();
if($mail->user_id != Auth::user()->id) {
abort(401);
}
if($mail->primary) {
return "You cant delete your primary mail";
}
$mail->delete();
return redirect("/gui/profile");
}
public function changePassword(Request $request) {
if(!Auth::check()) {
abort(401);
}
$this->validate($request, [
'password' => 'required|min:8'
]);
$user = Auth::user();
$user->password = password_hash($request->input("password"), PASSWORD_BCRYPT);
$user->saveOrFail();
return redirect('/gui/logout');
} }

View file

@ -0,0 +1,29 @@
<?php
namespace App\Http\Resources\API;
use Illuminate\Http\Resources\Json\JsonResource;
class User extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => (int)$this->id,
'username' => $this->username,
'created_at' => $this->created_at,
'updated_at' => $this->created_at,
'primaryMail' => $this->getMail(),
'status' => $this->status,
'inviteCode' => $this->inviteCode,
'developer' => (bool)$this->developer,
'admin' => (bool)$this->admin
];
}
}

View file

@ -62,6 +62,9 @@ class AuthServiceProvider extends ServiceProvider
} }
$accessToken = AccessToken::query()->where("token", "=", $token)->first(); $accessToken = AccessToken::query()->where("token", "=", $token)->first();
if($accessToken == null) {
return null;
}
if(time() > strtotime($accessToken->expires_at)) { if(time() > strtotime($accessToken->expires_at)) {
return null; return null;
} }

View file

@ -61,6 +61,11 @@ $app->singleton(
// App\Http\Middleware\ExampleMiddleware::class // App\Http\Middleware\ExampleMiddleware::class
// ]); // ]);
$app->middleware(array(
TaGeSo\APIResponse\Middelware::class
));
$app->routeMiddleware([ $app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class, 'auth' => App\Http\Middleware\Authenticate::class,
'gui' => \App\Http\Middleware\View::class 'gui' => \App\Http\Middleware\View::class

View file

@ -8,7 +8,8 @@
"php": ">=7.1.3", "php": ">=7.1.3",
"laravel/lumen-framework": "5.8.*", "laravel/lumen-framework": "5.8.*",
"vlucas/phpdotenv": "^3.3", "vlucas/phpdotenv": "^3.3",
"phpmailer/phpmailer": "~6.0" "phpmailer/phpmailer": "~6.0",
"tageso/api-response": "*"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "^1.4", "fzaninotto/faker": "^1.4",
@ -39,6 +40,12 @@
"sort-packages": true, "sort-packages": true,
"optimize-autoloader": true "optimize-autoloader": true
}, },
"repositories": [
{
"type": "vcs",
"url": "https://github.com/tageso/apiResponse.git"
}
],
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true "prefer-stable": true
} }

263
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "74d08bf87436d07aa38f8ee1bcbdfb68", "content-hash": "265697a07793434d0d8ac306debafc74",
"packages": [ "packages": [
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
@ -240,16 +240,16 @@
}, },
{ {
"name": "illuminate/auth", "name": "illuminate/auth",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/auth.git", "url": "https://github.com/illuminate/auth.git",
"reference": "47647ba0b0fbc2dae3fc1f9533ed9acacf320457" "reference": "a3a396e03eb96b182364b7bdf4cd3d97f64b1dac"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/auth/zipball/47647ba0b0fbc2dae3fc1f9533ed9acacf320457", "url": "https://api.github.com/repos/illuminate/auth/zipball/a3a396e03eb96b182364b7bdf4cd3d97f64b1dac",
"reference": "47647ba0b0fbc2dae3fc1f9533ed9acacf320457", "reference": "a3a396e03eb96b182364b7bdf4cd3d97f64b1dac",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -287,20 +287,20 @@
], ],
"description": "The Illuminate Auth package.", "description": "The Illuminate Auth package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-04-16T01:46:33+00:00" "time": "2019-04-22T18:45:14+00:00"
}, },
{ {
"name": "illuminate/broadcasting", "name": "illuminate/broadcasting",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/broadcasting.git", "url": "https://github.com/illuminate/broadcasting.git",
"reference": "f6806fbcc33cfa930a4f0b43018b416f72dfc5c1" "reference": "4e855c50e5fe18272571db6c303f6ca096b8406b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/broadcasting/zipball/f6806fbcc33cfa930a4f0b43018b416f72dfc5c1", "url": "https://api.github.com/repos/illuminate/broadcasting/zipball/4e855c50e5fe18272571db6c303f6ca096b8406b",
"reference": "f6806fbcc33cfa930a4f0b43018b416f72dfc5c1", "reference": "4e855c50e5fe18272571db6c303f6ca096b8406b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -338,11 +338,11 @@
], ],
"description": "The Illuminate Broadcasting package.", "description": "The Illuminate Broadcasting package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-03-27T10:17:08+00:00" "time": "2019-04-22T18:38:59+00:00"
}, },
{ {
"name": "illuminate/bus", "name": "illuminate/bus",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/bus.git", "url": "https://github.com/illuminate/bus.git",
@ -387,16 +387,16 @@
}, },
{ {
"name": "illuminate/cache", "name": "illuminate/cache",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/cache.git", "url": "https://github.com/illuminate/cache.git",
"reference": "f5f2c61956970fbfe93259a9e47a6096608377f7" "reference": "f25be6bcdb77da215f9c7fd16899c213c8a58beb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/cache/zipball/f5f2c61956970fbfe93259a9e47a6096608377f7", "url": "https://api.github.com/repos/illuminate/cache/zipball/f25be6bcdb77da215f9c7fd16899c213c8a58beb",
"reference": "f5f2c61956970fbfe93259a9e47a6096608377f7", "reference": "f25be6bcdb77da215f9c7fd16899c213c8a58beb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -432,11 +432,11 @@
], ],
"description": "The Illuminate Cache package.", "description": "The Illuminate Cache package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-04-12T12:37:19+00:00" "time": "2019-04-22T18:38:59+00:00"
}, },
{ {
"name": "illuminate/config", "name": "illuminate/config",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/config.git", "url": "https://github.com/illuminate/config.git",
@ -480,7 +480,7 @@
}, },
{ {
"name": "illuminate/console", "name": "illuminate/console",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/console.git", "url": "https://github.com/illuminate/console.git",
@ -531,16 +531,16 @@
}, },
{ {
"name": "illuminate/container", "name": "illuminate/container",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/container.git", "url": "https://github.com/illuminate/container.git",
"reference": "b984960d2634c6be97b0dd368a8953e8c4e06ec7" "reference": "9405989993a48c2cd50ad1e5b2b08a33383c3807"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/b984960d2634c6be97b0dd368a8953e8c4e06ec7", "url": "https://api.github.com/repos/illuminate/container/zipball/9405989993a48c2cd50ad1e5b2b08a33383c3807",
"reference": "b984960d2634c6be97b0dd368a8953e8c4e06ec7", "reference": "9405989993a48c2cd50ad1e5b2b08a33383c3807",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -572,20 +572,20 @@
], ],
"description": "The Illuminate Container package.", "description": "The Illuminate Container package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-03-03T15:13:35+00:00" "time": "2019-04-22T13:12:35+00:00"
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
"reference": "053c578b5a95fc50fa62266ff720ef74790e938e" "reference": "0b3cbe19051c9a8c247091cc0867d3b65250d093"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/053c578b5a95fc50fa62266ff720ef74790e938e", "url": "https://api.github.com/repos/illuminate/contracts/zipball/0b3cbe19051c9a8c247091cc0867d3b65250d093",
"reference": "053c578b5a95fc50fa62266ff720ef74790e938e", "reference": "0b3cbe19051c9a8c247091cc0867d3b65250d093",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -616,20 +616,20 @@
], ],
"description": "The Illuminate Contracts package.", "description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-04-16T12:47:20+00:00" "time": "2019-04-21T18:51:09+00:00"
}, },
{ {
"name": "illuminate/database", "name": "illuminate/database",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/database.git", "url": "https://github.com/illuminate/database.git",
"reference": "41f6e70fc500f8b6584e4899a176f8010e0fc077" "reference": "a68f2ea08627af047b9d58feb2b1e3697a8bf298"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/database/zipball/41f6e70fc500f8b6584e4899a176f8010e0fc077", "url": "https://api.github.com/repos/illuminate/database/zipball/a68f2ea08627af047b9d58feb2b1e3697a8bf298",
"reference": "41f6e70fc500f8b6584e4899a176f8010e0fc077", "reference": "a68f2ea08627af047b9d58feb2b1e3697a8bf298",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -676,11 +676,11 @@
"orm", "orm",
"sql" "sql"
], ],
"time": "2019-04-15T13:11:55+00:00" "time": "2019-04-22T19:09:23+00:00"
}, },
{ {
"name": "illuminate/encryption", "name": "illuminate/encryption",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/encryption.git", "url": "https://github.com/illuminate/encryption.git",
@ -727,7 +727,7 @@
}, },
{ {
"name": "illuminate/events", "name": "illuminate/events",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/events.git", "url": "https://github.com/illuminate/events.git",
@ -772,7 +772,7 @@
}, },
{ {
"name": "illuminate/filesystem", "name": "illuminate/filesystem",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/filesystem.git", "url": "https://github.com/illuminate/filesystem.git",
@ -824,7 +824,7 @@
}, },
{ {
"name": "illuminate/hashing", "name": "illuminate/hashing",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/hashing.git", "url": "https://github.com/illuminate/hashing.git",
@ -868,16 +868,16 @@
}, },
{ {
"name": "illuminate/http", "name": "illuminate/http",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/http.git", "url": "https://github.com/illuminate/http.git",
"reference": "5a3f9268561a8df637904dead361ed4e6b4eaf85" "reference": "c4a4db1ff72d2344e9fef585128a6792aceb8d2d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/http/zipball/5a3f9268561a8df637904dead361ed4e6b4eaf85", "url": "https://api.github.com/repos/illuminate/http/zipball/c4a4db1ff72d2344e9fef585128a6792aceb8d2d",
"reference": "5a3f9268561a8df637904dead361ed4e6b4eaf85", "reference": "c4a4db1ff72d2344e9fef585128a6792aceb8d2d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -911,11 +911,11 @@
], ],
"description": "The Illuminate Http package.", "description": "The Illuminate Http package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-03-29T18:03:35+00:00" "time": "2019-04-22T18:38:59+00:00"
}, },
{ {
"name": "illuminate/log", "name": "illuminate/log",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/log.git", "url": "https://github.com/illuminate/log.git",
@ -960,7 +960,7 @@
}, },
{ {
"name": "illuminate/pagination", "name": "illuminate/pagination",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/pagination.git", "url": "https://github.com/illuminate/pagination.git",
@ -1005,7 +1005,7 @@
}, },
{ {
"name": "illuminate/pipeline", "name": "illuminate/pipeline",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/pipeline.git", "url": "https://github.com/illuminate/pipeline.git",
@ -1049,16 +1049,16 @@
}, },
{ {
"name": "illuminate/queue", "name": "illuminate/queue",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/queue.git", "url": "https://github.com/illuminate/queue.git",
"reference": "ebd11d4c9e6b0c9593f466782f1d53eda4b1830a" "reference": "307904b5be3ed118009b67b735772e9964e92bad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/queue/zipball/ebd11d4c9e6b0c9593f466782f1d53eda4b1830a", "url": "https://api.github.com/repos/illuminate/queue/zipball/307904b5be3ed118009b67b735772e9964e92bad",
"reference": "ebd11d4c9e6b0c9593f466782f1d53eda4b1830a", "reference": "307904b5be3ed118009b67b735772e9964e92bad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1104,11 +1104,11 @@
], ],
"description": "The Illuminate Queue package.", "description": "The Illuminate Queue package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-02-23T14:59:33+00:00" "time": "2019-04-22T18:45:14+00:00"
}, },
{ {
"name": "illuminate/session", "name": "illuminate/session",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/session.git", "url": "https://github.com/illuminate/session.git",
@ -1159,16 +1159,16 @@
}, },
{ {
"name": "illuminate/support", "name": "illuminate/support",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/support.git", "url": "https://github.com/illuminate/support.git",
"reference": "5541fa4ee4b5ab4635056fae0eecad7d328b86b4" "reference": "e1b62fbf219dc1fa7154b0abef3975a41038bca7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/5541fa4ee4b5ab4635056fae0eecad7d328b86b4", "url": "https://api.github.com/repos/illuminate/support/zipball/e1b62fbf219dc1fa7154b0abef3975a41038bca7",
"reference": "5541fa4ee4b5ab4635056fae0eecad7d328b86b4", "reference": "e1b62fbf219dc1fa7154b0abef3975a41038bca7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1216,20 +1216,20 @@
], ],
"description": "The Illuminate Support package.", "description": "The Illuminate Support package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-04-14T05:44:06+00:00" "time": "2019-04-22T13:12:35+00:00"
}, },
{ {
"name": "illuminate/translation", "name": "illuminate/translation",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/translation.git", "url": "https://github.com/illuminate/translation.git",
"reference": "7d9cc548c9bb99fb344ab7b78f2f067372beedbd" "reference": "f42b8ab5016acb6f4971bb851cbdee1949a135bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/translation/zipball/7d9cc548c9bb99fb344ab7b78f2f067372beedbd", "url": "https://api.github.com/repos/illuminate/translation/zipball/f42b8ab5016acb6f4971bb851cbdee1949a135bf",
"reference": "7d9cc548c9bb99fb344ab7b78f2f067372beedbd", "reference": "f42b8ab5016acb6f4971bb851cbdee1949a135bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1262,11 +1262,11 @@
], ],
"description": "The Illuminate Translation package.", "description": "The Illuminate Translation package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-02-18T18:37:54+00:00" "time": "2019-04-22T13:12:35+00:00"
}, },
{ {
"name": "illuminate/validation", "name": "illuminate/validation",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/validation.git", "url": "https://github.com/illuminate/validation.git",
@ -1318,16 +1318,16 @@
}, },
{ {
"name": "illuminate/view", "name": "illuminate/view",
"version": "v5.8.12", "version": "v5.8.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/view.git", "url": "https://github.com/illuminate/view.git",
"reference": "329b5b1fa3461b8c730d1c909f710e72f5c2fa03" "reference": "a62ef6b6c4392a8bb5cf3af5f5076459525286c5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/view/zipball/329b5b1fa3461b8c730d1c909f710e72f5c2fa03", "url": "https://api.github.com/repos/illuminate/view/zipball/a62ef6b6c4392a8bb5cf3af5f5076459525286c5",
"reference": "329b5b1fa3461b8c730d1c909f710e72f5c2fa03", "reference": "a62ef6b6c4392a8bb5cf3af5f5076459525286c5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1363,20 +1363,20 @@
], ],
"description": "The Illuminate View package.", "description": "The Illuminate View package.",
"homepage": "https://laravel.com", "homepage": "https://laravel.com",
"time": "2019-04-12T13:14:04+00:00" "time": "2019-04-17T14:14:38+00:00"
}, },
{ {
"name": "laravel/lumen-framework", "name": "laravel/lumen-framework",
"version": "v5.8.4", "version": "v5.8.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/lumen-framework.git", "url": "https://github.com/laravel/lumen-framework.git",
"reference": "21cd20da632e67ec5bc53b56a51a717ff7202e97" "reference": "0d5b7e655450a04dc9fe75dd956057c95bad4811"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/lumen-framework/zipball/21cd20da632e67ec5bc53b56a51a717ff7202e97", "url": "https://api.github.com/repos/laravel/lumen-framework/zipball/0d5b7e655450a04dc9fe75dd956057c95bad4811",
"reference": "21cd20da632e67ec5bc53b56a51a717ff7202e97", "reference": "0d5b7e655450a04dc9fe75dd956057c95bad4811",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1448,7 +1448,7 @@
"laravel", "laravel",
"lumen" "lumen"
], ],
"time": "2019-03-21T17:35:25+00:00" "time": "2019-04-19T14:18:28+00:00"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@ -1530,16 +1530,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.16.3", "version": "2.17.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "373d9f0d58651af366435148c39beb702c2b7ef4" "reference": "9b49d637ad009e5e211142bc7492adcb19dbd645"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/373d9f0d58651af366435148c39beb702c2b7ef4", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/9b49d637ad009e5e211142bc7492adcb19dbd645",
"reference": "373d9f0d58651af366435148c39beb702c2b7ef4", "reference": "9b49d637ad009e5e211142bc7492adcb19dbd645",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1549,9 +1549,9 @@
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.14 || ^3.0", "friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
"kylekatarnls/multi-tester": "^0.1", "kylekatarnls/multi-tester": "^1.1",
"phpmd/phpmd": "^2.6", "phpmd/phpmd": "^2.6",
"phpstan/phpstan": "^0.10.8", "phpstan/phpstan": "^0.11",
"phpunit/phpunit": "^7.5 || ^8.0", "phpunit/phpunit": "^7.5 || ^8.0",
"squizlabs/php_codesniffer": "^3.4" "squizlabs/php_codesniffer": "^3.4"
}, },
@ -1586,7 +1586,7 @@
"datetime", "datetime",
"time" "time"
], ],
"time": "2019-04-06T17:09:23+00:00" "time": "2019-04-17T08:51:36+00:00"
}, },
{ {
"name": "nikic/fast-route", "name": "nikic/fast-route",
@ -1957,7 +1957,7 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
@ -2097,7 +2097,7 @@
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
@ -2153,7 +2153,7 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
@ -2217,7 +2217,7 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
@ -2266,16 +2266,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1" "reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6ebbe61f48069033225c9d3fa7eb5ed116d766d6",
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1", "reference": "6ebbe61f48069033225c9d3fa7eb5ed116d766d6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2316,20 +2316,20 @@
], ],
"description": "Symfony HttpFoundation Component", "description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2019-03-30T15:58:42+00:00" "time": "2019-04-17T14:56:00+00:00"
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "72f5f8f9dd6e6fbda0220ded537610ad20fa2ce8" "reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/72f5f8f9dd6e6fbda0220ded537610ad20fa2ce8", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3db83303dbc1da9777e5ff63423b8b7fde423a1b",
"reference": "72f5f8f9dd6e6fbda0220ded537610ad20fa2ce8", "reference": "3db83303dbc1da9777e5ff63423b8b7fde423a1b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2405,7 +2405,7 @@
], ],
"description": "Symfony HttpKernel Component", "description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2019-04-16T07:20:25+00:00" "time": "2019-04-17T16:17:13+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -2581,7 +2581,7 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
@ -2630,7 +2630,7 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
@ -2705,16 +2705,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.2.6", "version": "v4.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "f42850fa32b8d7a35a75510810f6ef597674be74" "reference": "e760a38e12b15032325e64be63f7ffc1817af617"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f42850fa32b8d7a35a75510810f6ef597674be74", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e760a38e12b15032325e64be63f7ffc1817af617",
"reference": "f42850fa32b8d7a35a75510810f6ef597674be74", "reference": "e760a38e12b15032325e64be63f7ffc1817af617",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2777,7 +2777,46 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2019-04-11T11:27:41+00:00" "time": "2019-04-17T14:57:01+00:00"
},
{
"name": "tageso/api-response",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/tageso/apiResponse.git",
"reference": "510e4233d31506f5bd4e6d3456d55297d8c0376d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tageso/apiResponse/zipball/510e4233d31506f5bd4e6d3456d55297d8c0376d",
"reference": "510e4233d31506f5bd4e6d3456d55297d8c0376d",
"shasum": ""
},
"require": {
"laravel/lumen-framework": "5.*"
},
"type": "library",
"autoload": {
"psr-0": {
"TaGeSo\\APIResponse\\": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "soeren",
"email": "hello@kekskurse.de"
}
],
"description": "Lumen API Response Class and Middelware",
"support": {
"source": "https://github.com/tageso/apiResponse/tree/master",
"issues": "https://github.com/tageso/apiResponse/issues"
},
"time": "2019-04-25T15:20:37+00:00"
}, },
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
@ -3671,16 +3710,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "7.5.8", "version": "7.5.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a" "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c29c0525cf4572c11efe1db49a8b8aee9dfac58a", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/134669cf0eeac3f79bc7f0c793efbc158bffc160",
"reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a", "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3751,7 +3790,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2019-03-26T13:23:54+00:00" "time": "2019-04-19T15:50:46+00:00"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@ -3920,16 +3959,16 @@
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
"version": "4.1.0", "version": "4.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/environment.git", "url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3095910f0f0fb155ac4021fc51a4a7a39ac04e8a",
"reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3944,7 +3983,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.1-dev" "dev-master": "4.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -3969,7 +4008,7 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"time": "2019-02-01T05:27:49+00:00" "time": "2019-04-25T07:55:20+00:00"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class FixMailBug extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("mails", function(Blueprint $table) {
// e.g. $table->dropUnique('email');
$table->dropForeign('mails_user_id_foreign');
$table->dropUnique('unique_primary_email');
$table->foreign('user_id')->references('id')->on('users');
});
Schema::table("users", function(Blueprint $table) {
// e.g. $table->dropUnique('email');
$table->string('inviteCode')->nullable()->default(null)->comment("Invite code user used to register");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
return false;
// Vorwärts immer, rückwerts nimmer
}
}

View file

@ -0,0 +1,29 @@
<?php include(__DIR__."/../layout/top.php"); ?>
<div class="row">
<div class="col-md-12">
<h3>App Access</h3>
<p>Here is a list of all Apps who have access to your Account. You can remove the Access if you want to.</p>
<table class="table">
<tr>
<th>App Name</th>
<th>App Beschreibung</th>
<th>Zugriff seit</th>
<th style="text-align: right">Aktionen</th>
</tr>
<?php
foreach($access as $a) {
?>
<tr>
<td><?php echo $a->getApp()->name; ?></td>
<td><?php echo $a->getApp()->description; ?></td>
<td><?php echo $a->created_at->format("d.m.Y H:i"); ?></td>
<td style="text-align: right"><a href="/gui/access/rm?id=<?php echo $a->id; ?>" class="btn btn-danger btn-sm">Remove Access</a> </td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<?php include(__DIR__."/../layout/bottom.php"); ?>

View file

@ -0,0 +1,73 @@
<?php include(__DIR__."/../layout/top.php"); ?>
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#overview" role="tab" aria-controls="overview" aria-selected="true">Overview</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#mail" role="tab" aria-controls="mail" aria-selected="false">E-Mail adressen</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#password" role="tab" aria-controls="password" aria-selected="false">Password</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
<h3>Profile</h3>
Here you can change your Profile Settings.
</div>
<div class="tab-pane fade" id="mail" role="tabpanel" aria-labelledby="mail-tab">
<h4>E-Mail adresses</h4>
<table class="table">
<tr>
<th>E-Mail</th>
<th>Status</th>
<th>Primary E-Mail</th>
<th>Action</th>
</tr>
<?php
foreach($mails as $mail) {
?>
<tr>
<td><?php echo $mail->mail; ?></td>
<td><?php echo ucfirst($mail->status); ?></td>
<td><?php if($mail->primary) { echo '<i class="fas fa-check-circle"></i>'; } ?></td>
<td>
<?php
if(!$mail->primary) {
echo '<a href="/gui/profile/removeMail?mail='.$mail->id.'" class="btn btn-danger btn-sm">Remove</a> ';
}
if($mail->status == "valide" && !$mail->primary) {
echo '<a href="/gui/profile/changePrimaryMail?mail='.$mail->id.'" class="btn btn-warning btn-sm">Use as Primary Mail Adress</a> ';
}
?>
</td>
</tr>
<?php
}
?>
</table>
<br>
<b>Add a new E-Mail adresse</b>
<p>You can add multible Mail Addresses to your Account, to add another one enter the address in the form below. After that we send you a E-Mail to validate the Address.</p>
<form method="post" action="/gui/profile/addMail">
<input type="email" name="mail" class="form-control" placeholder="mail@example.com"><br>
<input type="submit" value="Add E-Mail" class="btn btn-success">
</form>
</div>
<div class="tab-pane fade" id="password" role="tabpanel" aria-labelledby="password-tab">
<p>Change your Account Password.</p>
<form method="post" action="/gui/profile/changePassword">
<input type="password" name="password" class="form-control" placeholder="New Password"><br>
<input type="submit" class="btn btn-warning" value="Change Password">
</form>
</div>
</div>
</div>
</div>
<?php include(__DIR__."/../layout/bottom.php"); ?>

View file

@ -68,8 +68,9 @@
<?php echo $user->username; ?> <?php echo $user->username; ?>
</a> </a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> <div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item disabled" href="#">Profile</a> <a class="dropdown-item" href="/gui/profile">Profile</a>
<a class="dropdown-item disabled" href="#">Privacy</a> <a class="dropdown-item" href="/gui/access">Apps</a>
<!--<a class="dropdown-item disabled" href="#">Privacy</a>!-->
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="/gui/logout">Logout</a> <a class="dropdown-item" href="/gui/logout">Logout</a>
</div> </div>

View file

@ -12,11 +12,19 @@
*/ */
$router->get('/', ['middleware' => 'gui', 'uses' => 'GUI\PublicController@index']); $router->get('/', ['middleware' => 'gui', 'uses' => 'GUI\PublicController@index']);
$router->get('/api/v4/user', ['uses' => 'oAuthController@getUserTMP']); #$router->get('/api/v4/user', ['uses' => 'oAuthController@getUserTMP']);
$router->get('/api/v4/groups', ['uses' => 'oAuthController@getGroupsTMP']); #$router->get('/api/v4/groups', ['uses' => 'oAuthController@getGroupsTMP']);
//Gitlab like oauth //Gitlab like oauth
$router->group(['prefix' => 'gitlab', 'middleware' => 'gui'], function () use ($router) { $router->group(['prefix' => 'gitlab', 'middleware' => 'gui'], function () use ($router) {
$router->group(['prefix' => 'oauth'], function () use ($router) {
$router->get("/authorize", ['middleware' => 'gui', 'uses' => 'oAuthController@authorizeView']);
$router->post("/authorize", ['middleware' => 'gui', 'uses' => 'oAuthController@authorizeDo']);
$router->post("/token", ['uses' => 'oAuthController@token']);
});
$router->get('/api/v4/user', ['uses' => 'oAuthController@getUserTMP']);
$router->get('/api/v4/groups', ['uses' => 'oAuthController@getGroupsTMP']);
}); });
@ -29,7 +37,13 @@ $router->group(['prefix' => 'oauth'], function () use ($router) {
//Internal API //Internal API
$router->group(['prefix' => 'api'], function () use ($router) { $router->group(['prefix' => 'api', 'middleware' => 'auth'], function () use ($router) {
$router->group(['prefix' => 'v1'], function () use ($router) {
$router->group(['prefix' => 'account'], function () use ($router) {
$router->get("/", ['uses' => 'API\AccountController@getUsers']);
$router->get("/{id}", ['uses' => 'API\AccountController@getUser']);
});
});
}); });
$router->group(['prefix' => 'gui', 'middleware' => 'gui'], function () use ($router) { $router->group(['prefix' => 'gui', 'middleware' => 'gui'], function () use ($router) {
@ -66,9 +80,18 @@ $router->group(['prefix' => 'gui', 'middleware' => 'gui'], function () use ($rou
$router->get('user/profile', function () {
// Uses Auth Middleware
}); $router->get('/profile', ['uses' => 'GUI\AccountController@profileView']);
$router->post('/profile/addMail', ['uses' => 'GUI\AccountController@addMail']);
$router->get('/profile/changePrimaryMail', ['uses' => 'GUI\AccountController@changePrimaryMail']);
$router->get('/profile/removeMail', ['uses' => 'GUI\AccountController@removeMail']);
$router->post('/profile/changePassword', ['uses' => 'GUI\AccountController@changePassword']);
$router->get('/access', ['uses' => 'GUI\AccessController@listAccess']);
$router->get('/access/rm', ['uses' => 'GUI\AccessController@removeAccess']);
}); });
/*$router->group(['prefix' => 'api'], function () use ($router) { /*$router->group(['prefix' => 'api'], function () use ($router) {