mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:57:35 -05:00 
			
		
		
		
	Merge pull request #8546 from turbo124/v5-develop
fixes for react links
This commit is contained in:
		
						commit
						1fc7e48445
					
				@ -35,7 +35,10 @@ trait VerifiesUserEmail
 | 
				
			|||||||
        $user = User::where('confirmation_code', request()->confirmation_code)->first();
 | 
					        $user = User::where('confirmation_code', request()->confirmation_code)->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! $user) {
 | 
					        if (! $user) {
 | 
				
			||||||
            return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]);
 | 
					            return $this->render('auth.confirmed', [
 | 
				
			||||||
 | 
					                'root' => 'themes', 
 | 
				
			||||||
 | 
					                'message' => ctrans('texts.wrong_confirmation'),
 | 
				
			||||||
 | 
					                'redirect_url' => request()->has('react') ? config('ninja.react_url')."/#/" : url('/')]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $user->email_verified_at = now();
 | 
					        $user->email_verified_at = now();
 | 
				
			||||||
@ -46,16 +49,18 @@ trait VerifiesUserEmail
 | 
				
			|||||||
            return $this->render('auth.confirmed', [
 | 
					            return $this->render('auth.confirmed', [
 | 
				
			||||||
                'root' => 'themes',
 | 
					                'root' => 'themes',
 | 
				
			||||||
                'message' => ctrans('texts.security_confirmation'),
 | 
					                'message' => ctrans('texts.security_confirmation'),
 | 
				
			||||||
 | 
					                'redirect_url' => request()->has('react') ? config('ninja.react_url')."/#/" : url('/'),
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($user->password) || empty($user->password) || Hash::check('', $user->password)) {
 | 
					        if (is_null($user->password) || empty($user->password) || Hash::check('', $user->password)) {
 | 
				
			||||||
            return $this->render('auth.confirmation_with_password', ['root' => 'themes', 'user_id' => $user->hashed_id]);
 | 
					            return $this->render('auth.confirmation_with_password', ['root' => 'themes', 'user_id' => $user->hashed_id, 'redirect_url' => request()->has('react') ? config('ninja.react_url')."/#/" : url('/')]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->render('auth.confirmed', [
 | 
					        return $this->render('auth.confirmed', [
 | 
				
			||||||
            'root' => 'themes',
 | 
					            'root' => 'themes',
 | 
				
			||||||
            'message' => ctrans('texts.security_confirmation'),
 | 
					            'message' => ctrans('texts.security_confirmation'),
 | 
				
			||||||
 | 
					            'redirect_url' => request()->has('react') ? config('ninja.react_url')."/#/" : url('/'),
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,7 +89,7 @@ trait VerifiesUserEmail
 | 
				
			|||||||
        return $this->render('auth.confirmed', [
 | 
					        return $this->render('auth.confirmed', [
 | 
				
			||||||
            'root' => 'themes',
 | 
					            'root' => 'themes',
 | 
				
			||||||
            'message' => ctrans('texts.security_confirmation'),
 | 
					            'message' => ctrans('texts.security_confirmation'),
 | 
				
			||||||
            'redirect_url' => request()->hasHeader('X-React') ? 'https://app.invoicing.co/#/' : url('/'),
 | 
					            'redirect_url' => request()->has('react') ? config('ninja.react_url')."/#/" : url('/'),
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -42,10 +42,16 @@ class VerifyUserObject
 | 
				
			|||||||
        $this->user->confirmation_code = $this->createDbHash($this->company->db);
 | 
					        $this->user->confirmation_code = $this->createDbHash($this->company->db);
 | 
				
			||||||
        $this->user->save();
 | 
					        $this->user->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $react_redirect = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(Ninja::isHosted()) {
 | 
				
			||||||
 | 
					            $react_redirect = '?react=true';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data = [
 | 
					        $data = [
 | 
				
			||||||
            'title' => ctrans('texts.confirmation_subject'),
 | 
					            'title' => ctrans('texts.confirmation_subject'),
 | 
				
			||||||
            'message' => ctrans('texts.confirmation_message'),
 | 
					            'message' => ctrans('texts.confirmation_message'),
 | 
				
			||||||
            'url' => url("/user/confirm/{$this->user->confirmation_code}"),
 | 
					            'url' => url("/user/confirm/{$this->user->confirmation_code}".$react_redirect),
 | 
				
			||||||
            'button' => ctrans('texts.button_confirmation_message'),
 | 
					            'button' => ctrans('texts.button_confirmation_message'),
 | 
				
			||||||
            'settings' => $this->company->settings,
 | 
					            'settings' => $this->company->settings,
 | 
				
			||||||
            'logo' => $this->company->present()->logo(),
 | 
					            'logo' => $this->company->present()->logo(),
 | 
				
			||||||
 | 
				
			|||||||
@ -869,6 +869,6 @@ class Client extends BaseModel implements HasLocalePreference
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function portalUrl(bool $use_react_url): string
 | 
					    public function portalUrl(bool $use_react_url): string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $use_react_url ? config('ninja.react_url'). "/clients/{$this->hashed_id}": config('ninja.app_url');
 | 
					        return $use_react_url ? config('ninja.react_url'). "/#/clients/{$this->hashed_id}": config('ninja.app_url');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -560,7 +560,7 @@ class Payment extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function portalUrl($use_react_url)
 | 
					    public function portalUrl($use_react_url)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $use_react_url ? config('ninja.react_url')."/payments/{$this->hashed_id}/edit" : config('ninja.app_url');
 | 
					        return $use_react_url ? config('ninja.react_url')."/#/payments/{$this->hashed_id}/edit" : config('ninja.app_url');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -203,6 +203,6 @@ class Product extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function portalUrl($use_react_url): string
 | 
					    public function portalUrl($use_react_url): string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $use_react_url ? config('ninja.react_url') . "/products/{$this->hashed_id}/edit" : config('ninja.app_url');
 | 
					        return $use_react_url ? config('ninja.react_url') . "/#/products/{$this->hashed_id}/edit" : config('ninja.app_url');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -203,7 +203,7 @@ class PurchaseOrderInvitation extends BaseModel
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
					        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return config('ninja.react_url')."/{$entity_type}s/{$this->{$entity_type}->hashed_id}/edit";
 | 
					        return config('ninja.react_url')."/#/{$entity_type}s/{$this->{$entity_type}->hashed_id}/edit";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -254,19 +254,6 @@ class Design extends BaseDesign
 | 
				
			|||||||
            return $elements;
 | 
					            return $elements;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // $elements = [
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'content' => ctrans('texts.shipping_address'), 'properties' => ['data-ref' => 'shipping_address-label', 'style' => 'font-weight: bold; text-transform: uppercase']],
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'content' => $this->client->name, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.name']],
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'content' => $this->client->shipping_address1, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address1']],
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'content' => $this->client->shipping_address2, 'show_empty' => false, 'properties' => ['data-ref' => 'shipping_address-client.shipping_address2']],
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'show_empty' => false, 'elements' => [
 | 
					 | 
				
			||||||
        //         ['element' => 'span', 'content' => "{$this->client->shipping_city} ", 'properties' => ['ref' => 'shipping_address-client.shipping_city']],
 | 
					 | 
				
			||||||
        //         ['element' => 'span', 'content' => "{$this->client->shipping_state} ", 'properties' => ['ref' => 'shipping_address-client.shipping_state']],
 | 
					 | 
				
			||||||
        //         ['element' => 'span', 'content' => "{$this->client->shipping_postal_code} ", 'properties' => ['ref' => 'shipping_address-client.shipping_postal_code']],
 | 
					 | 
				
			||||||
        //     ]],
 | 
					 | 
				
			||||||
        //     ['element' => 'p', 'content' => optional($this->client->shipping_country)->name, 'show_empty' => false],
 | 
					 | 
				
			||||||
        // ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $address_variables = [
 | 
					        $address_variables = [
 | 
				
			||||||
            '$client.address1',
 | 
					            '$client.address1',
 | 
				
			||||||
            '$client.address2',
 | 
					            '$client.address2',
 | 
				
			||||||
@ -287,7 +274,11 @@ class Design extends BaseDesign
 | 
				
			|||||||
            
 | 
					            
 | 
				
			||||||
        })->toArray();
 | 
					        })->toArray();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $elements;
 | 
					        $header = [];
 | 
				
			||||||
 | 
					        $header[] = ['element' => 'p', 'content' => ctrans('texts.shipping_address'), 'properties' => ['data-ref' => 'shipping_address-label', 'style' => 'font-weight: bold; text-transform: uppercase']];
 | 
				
			||||||
 | 
					        return array_merge($header, $elements);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // return $elements;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -148,6 +148,6 @@ trait Inviteable
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
					        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return config('ninja.react_url')."/{$entity_type}s/{$this->{$entity_type}->hashed_id}/edit";
 | 
					        return config('ninja.react_url')."/#/{$entity_type}s/{$this->{$entity_type}->hashed_id}/edit";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user