Ensure users can only login from the right site

This commit is contained in:
Deon George 2021-12-17 15:58:24 +11:00
parent 99a62828f5
commit 05c5d35dbf
6 changed files with 112 additions and 3 deletions

View File

@ -46,7 +46,7 @@ class LoginController extends Controller
{ {
$this->validateLogin($request); $this->validateLogin($request);
if (Auth::attempt(array_merge($this->credentials($request),['active'=>TRUE]))) { if (Auth::attempt(array_merge($this->credentials($request),['active'=>TRUE,'site_id'=>config('site')->site_id]))) {
$request->session()->regenerate(); $request->session()->regenerate();
return $this->sendLoginResponse($request); return $this->sendLoginResponse($request);

View File

@ -43,7 +43,7 @@ class SetSite
} }
// Set who we are in SETUP. // Set who we are in SETUP.
Config::set('SITE',$so); Config::set('site',$so);
if (! $request->ajax()) if (! $request->ajax())
View::share('site',$so); View::share('site',$so);

View File

@ -100,7 +100,7 @@ class Product extends Model implements IDs
private function getDefaultLanguage() private function getDefaultLanguage()
{ {
return config('SITE')->language; return config('site')->language;
} }
public function getDescriptionAttribute() public function getDescriptionAttribute()

View File

@ -0,0 +1,10 @@
<!-- Main Footer -->
<footer class="main-footer">
<!-- To the right -->
<div class="float-right d-sm-none d-md-block">
{{ config('app.name') }}
</div>
<!-- Default to the left -->
<strong>&copy; {{ \Carbon\Carbon::now()->year }} <a href="#">Leenooks</a>.</strong> All rights reserved. [#{{ $site->site_id }}]
</footer>

View File

@ -0,0 +1,99 @@
{{-- This page needs $site_social --}}
<!-- BEGIN PRE-FOOTER -->
<div class="pre-footer">
<div class="container">
<div class="row">
<!-- BEGIN BOTTOM ABOUT BLOCK -->
<div class="col-md-4 col-sm-6 pre-footer-col">
@isset($site->site_aboutus))
<h2>About us</h2>
<p>{!! $site->site_aboutus !!}</p>
<!--
<div class="photo-stream">
<h2>Photos Stream</h2>
<ul class="list-unstyled">
<li><a href="javascript:;"><img alt="" src="{{!! Theme::url('/') !!}}"></a></li>
</ul>
</div>
-->
@endisset
</div>
<!-- END BOTTOM ABOUT BLOCK -->
<!-- BEGIN BOTTOM CONTACTS -->
<div class="col-md-offset-5 col-md-3 col-sm-6 pre-footer-col">
<h2 style="text-align: right;">Our Contact Details</h2>
<address class="margin-bottom-40" style="float: right;">
<table>
<tr><th style="vertical-align:top; padding-right: 5px;">Address</th><td>{!! join('<br>',$site->address) !!}</td></tr>
@isset($site->site_fax)
<tr><th>Fax</th><td>{{ $site->site_fax }}</tr>
@endif
<tr><th>Email</th><td> <a href="mailto:{{ $site->site_email }}">{{ $site->site_email }}</a></tr>
</table>
</address>
<!--
<div class="pre-footer-subscribe-box pre-footer-subscribe-box-vertical">
<h2>Newsletter</h2>
<p>Subscribe to our newsletter and stay up to date with the latest news and deals!</p>
<form action="#">
<div class="input-group">
<input type="text" placeholder="youremail@mail.com" class="form-control">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Subscribe</button>
</span>
</div>
</form>
</div>
-->
</div>
<!-- END BOTTOM CONTACTS -->
<!-- BEGIN TWITTER BLOCK -->
<!--
<div class="col-md-4 col-sm-6 pre-footer-col">
<h2 class="margin-bottom-0">Latest Tweets</h2>
<a class="twitter-timeline" href="https://twitter.com/twitterapi" data-tweet-limit="2" data-theme="dark" data-link-color="#57C8EB" data-widget-id="" data-chrome="noheader nofooter noscrollbar noborders transparent">Loading tweets...</a>
</div>
-->
<!-- END TWITTER BLOCK -->
<!-- BEGIN ADDRESS MAP -->
{{-- @todo --}}
<!-- END ADDRESS MAP -->
</div>
</div>
</div>
<!-- END PRE-FOOTER -->
<!-- BEGIN FOOTER -->
<div class="footer">
<div class="container">
<div class="row">
<!-- BEGIN COPYRIGHT -->
<div class="col-md-4 col-sm-4 padding-top-10">
&copy; {{ \Carbon\Carbon::now()->year }} Leenooks. ALL Rights Reserved. [#{{ $site->site_id }}]<!-- <a href="javascript:;">Privacy Policy</a> | <a href="javascript:;">Terms of Service</a> -->
</div>
<!-- END COPYRIGHT -->
<!-- BEGIN SOCIAL -->
<div class="col-md-4 col-sm-4">
<ul class="social-footer list-unstyled list-inline pull-right">
@foreach ($site->social as $social)
<li><a href="{{ $social['url'] }}"><i class="fab fa-{{ $social['name'] }}"></i></a></li>
@endforeach
</ul>
</div>
<!-- END SOCIAL -->
<!-- BEGIN POWERED -->
<div class="col-md-4 col-sm-4 text-right">
<p class="powered">Powered by: <a href="http://www.leenooks.net/">leenooks</a></p>
</div>
<!-- END POWERED -->
</div>
</div>
</div>
<!-- END FOOTER -->