New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added take to previous URL after login feature. #5

Merged
merged 2 commits into from Feb 2, 2018
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+23 −1
Diff settings

Always

Just for now

@@ -36,12 +36,15 @@ class LoginController extends Controller
/**
* Create a new controller instance.
*
* @param Request $request
* @return void
*/
public function __construct()
public function __construct(Request $request)
{
$this->middleware('authorize')->only('login');
$this->middleware('guest')->except('logout');
$this->request = $request;
}
/**
@@ -61,4 +64,16 @@ protected function credentials(Request $request)
'password' => $request->password,
];
}
/**
* @return string
*/
public function redirectTo()
{
if ($this->request->has('previous')) {
$this->redirectTo = $this->request->get('previous');
}
return $this->redirectTo ?? '/home';
}
}
@@ -20,6 +20,13 @@
@endif
</div>
</div>
<div class="form-group">
@if (Request::has('previous'))
<input type="hidden" name="previous" value="{{ Request::get('previous') }}">
@else
<input type="hidden" name="previous" value="{{ URL::previous() }}">
@endif
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
ProTip! Use n and p to navigate between commits in a pull request.