mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-05 13:45:57 +00:00
- authentication fix
- demo helper
This commit is contained in:
@@ -51,7 +51,7 @@ class PagesController extends Controller
|
||||
*/
|
||||
public function update(Request $request, Page $page)
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class PlanController extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
// TODO: inline request
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
|
||||
if (Cache::has('plan-starter-pack')) {
|
||||
$plan = Cache::get('plan-starter-pack');
|
||||
@@ -110,7 +110,7 @@ class PlanController extends Controller
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class PlanController extends Controller
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class SettingController extends Controller
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class SettingController extends Controller
|
||||
public function set_email(Request $request)
|
||||
{
|
||||
// TODO: pridat validator do requestu
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class SettingController extends Controller
|
||||
*/
|
||||
public function flush_cache()
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return $this->demo->response_with_no_content();
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ class UserController extends Controller
|
||||
public function change_role(ChangeRoleRequest $request, User $user)
|
||||
{
|
||||
// Demo preview
|
||||
if (env('APP_DEMO') && $user->email === 'howdy@hi5ve.digial') {
|
||||
if (is_demo_account('howdy@hi5ve.digial')) {
|
||||
return new UserResource($user);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ class UserController extends Controller
|
||||
public function reset_password(User $user)
|
||||
{
|
||||
// Demo preview
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return response('Done!', 204);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function delete_user(DeleteUserRequest $request, User $user)
|
||||
{
|
||||
if (env('APP_DEMO')) {
|
||||
if (is_demo()) {
|
||||
return response('Done!', 204);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class UserResource extends JsonResource
|
||||
'subscription' => $this->subscribed('main'),
|
||||
'incomplete_payment' => $this->hasIncompletePayment('main') ? route('cashier.payment', $this->subscription('main')->latestPayment()->id) : null,
|
||||
'stripe_customer' => is_null($this->stripe_id) ? false : true,
|
||||
'email' => env('APP_DEMO') ? obfuscate_email($this->email) : $this->email,
|
||||
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
'folders' => $this->folder_tree,
|
||||
'storage' => $this->storage,
|
||||
|
||||
+13
-2
@@ -202,11 +202,22 @@ function get_version()
|
||||
/**
|
||||
* Check if is demo
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_demo()
|
||||
{
|
||||
return config('vuefilemanager.is_demo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if is demo
|
||||
*
|
||||
* @param $email
|
||||
* @return mixed
|
||||
*/
|
||||
function is_demo($user_id)
|
||||
function is_demo_account($email)
|
||||
{
|
||||
return env('APP_DEMO', false) && $user_id === 1;
|
||||
return config('vuefilemanager.is_demo') && $email === 'howdy@hi5ve.digital';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user