mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:01:24 +00:00
Use session for login and logout messages
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class LoginController extends Controller
|
||||
@@ -67,9 +68,8 @@ class LoginController extends Controller
|
||||
|
||||
if ($this->hasTooManyLoginAttempts($request)) {
|
||||
$this->fireLockoutEvent($request);
|
||||
$error = 'You have failed to login too many times.Try again in: '.$this->decayMinutes().' minutes.';
|
||||
|
||||
return $this->showLoginForm($error);
|
||||
Session::flash('message', 'You have failed to login too many times.Try again in '.$this->decayMinutes().' minutes.');
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
if ($validator->passes()) {
|
||||
@@ -88,7 +88,8 @@ class LoginController extends Controller
|
||||
$rememberMe = $request->has('rememberme') && $request->input('rememberme') === 'on';
|
||||
|
||||
if (! $user->isVerified() || $user->isPendingVerification()) {
|
||||
return $this->showLoginForm('You have not verified your email address!');
|
||||
Session::flash('message', 'You have not verified your email address!');
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
if (Auth::attempt($request->only($login_type, 'password'), $rememberMe)) {
|
||||
@@ -102,30 +103,24 @@ class LoginController extends Controller
|
||||
}
|
||||
|
||||
$this->incrementLoginAttempts($request);
|
||||
$error = 'Username or email and password combination used does not match our records!';
|
||||
Session::flash('message', 'Username or email and password combination used does not match our records!');
|
||||
} else {
|
||||
$this->incrementLoginAttempts($request);
|
||||
$error = 'Username or email used do not match our records!';
|
||||
Session::flash('message', 'Username or email used do not match our records!');
|
||||
}
|
||||
|
||||
return $this->showLoginForm($error);
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
$this->incrementLoginAttempts($request);
|
||||
Session::flash('message', implode('', Arr::collapse($validator->errors()->toArray())));
|
||||
|
||||
$error = implode('', Arr::collapse($validator->errors()->toArray()));
|
||||
|
||||
return $this->showLoginForm($error);
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $error
|
||||
* @param string $notice
|
||||
*/
|
||||
public function showLoginForm($error = '', $notice = '')
|
||||
public function showLoginForm()
|
||||
{
|
||||
$theme = Settings::settingValue('site.main.style');
|
||||
app('smarty.view')->assign(['error' => $error, 'notice' => $notice, 'username' => '', 'rememberme' => '']);
|
||||
|
||||
$meta_title = 'Login';
|
||||
$meta_keywords = 'Login';
|
||||
@@ -147,6 +142,6 @@ class LoginController extends Controller
|
||||
$request->session()->flush();
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect('login')->with('info', 'You have been logged out successfully');
|
||||
return redirect('login')->with('message', 'You have been logged out successfully');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<div class="card card-body card-header">
|
||||
{if isset($error) && $error != ''}
|
||||
<div class="alert alert-danger">{$error}</div>
|
||||
{/if}
|
||||
{if isset($notice) && $notice != ''}
|
||||
<div class="alert alert-info">{$notice}</div>
|
||||
{if Session::has('message')}
|
||||
<div class="alert alert-danger">{Session::get('message')}</div>
|
||||
{/if}
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
|
||||
{if Illuminate\Support\Facades\Session::has('success')}
|
||||
{if Session::has('success')}
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{Illuminate\Support\Facades\Session::get('success')}
|
||||
{Session::get('success')}
|
||||
</div>
|
||||
{/if}
|
||||
{if Illuminate\Support\Facades\Session::has('error')}
|
||||
{if Session::has('error')}
|
||||
<div class="alert alert-error alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{Illuminate\Support\Facades\Session::get('error')}
|
||||
{Session::get('error')}
|
||||
</div>
|
||||
{/if}
|
||||
{if Illuminate\Support\Facades\Session::has('info')}
|
||||
{if Session::has('info')}
|
||||
<div class="alert alert-info alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{Illuminate\Support\Facades\Session::get('info')}
|
||||
{Session::get('info')}
|
||||
</div>
|
||||
{/if}
|
||||
{if Illuminate\Support\Facades\Session::has('warning')}
|
||||
{if Session::has('warning')}
|
||||
<div class="alert alert-warning alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{Illuminate\Support\Facades\Session::get('warning')}
|
||||
{Session::get('warning')}
|
||||
</div>
|
||||
{/if}
|
||||
{if Illuminate\Support\Facades\Session::has('danger')}
|
||||
{if Session::has('danger')}
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{Illuminate\Support\Facades\Session::get('danger')}
|
||||
{Session::get('danger')}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user