Skip to content

Commit 3a6dc1d

Browse files
committed
work on Auth component
1 parent 136f2bf commit 3a6dc1d

File tree

7 files changed

+90
-29
lines changed

7 files changed

+90
-29
lines changed

src/Darryldecode/Backend/Components/Auth/Controllers/AuthController.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ public function __construct()
1919
/**
2020
* displays the login page
2121
*
22-
* @param Request $request
2322
* @return \Illuminate\View\View
2423
*/
25-
public function getLogin(Request $request)
24+
public function getLogin()
2625
{
2726
return view('authManager::login');
2827
}
@@ -38,10 +37,10 @@ public function postLogin(Request $request)
3837
$credentials = $request->only('email', 'password');
3938

4039
if (Auth::attempt($credentials, $request->has('remember'))) {
41-
return redirect()->intended(config('backend.backend.base_url').'/dashboard');
40+
return redirect()->intended(Helpers::getDashboardRoute());
4241
}
4342

44-
return redirect(config('backend.backend.login_route'))
43+
return redirect(Helpers::getLoginRoute())
4544
->withInput($request->only('email', 'remember'))
4645
->withErrors([
4746
'email' => 'These credentials do not match our records.',
@@ -57,6 +56,6 @@ public function getLogout()
5756
{
5857
Auth::logout();
5958

60-
return redirect(trim(config('backend.backend.base_url'),'/').'/'.trim(config('backend.backend.login_route'),'/'));
59+
return redirect(Helpers::getLoginRoute());
6160
}
6261
}

src/Darryldecode/Backend/Components/Auth/Controllers/PasswordController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class PasswordController extends BaseController {
2323
public function __construct()
2424
{
2525
parent::__construct();
26+
$this->middleware('backend.guest');
2627
}
2728

2829
/**
Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
1-
<!-- from package -->
2-
<form method="POST" action="{{ route('backend.authManager.postLogin') }}">
3-
{!! csrf_field() !!}
1+
<!DOCTYPE html>
2+
<html lang="en" data-ng-app="cb">
3+
<head>
44

5-
<div>
6-
Email
7-
<input type="email" name="email" value="{{ old('email') }}">
8-
</div>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<title>Content Builder</title>
99

10-
<div>
11-
Password
12-
<input type="password" name="password" id="password">
13-
</div>
10+
@include('backend::includes.styles')
1411

15-
<div>
16-
<input type="checkbox" name="remember"> Remember Me
17-
</div>
12+
<style>
13+
.lb-login-title {
14+
font-family: dancing_script, "arial narrow", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", Verdana, "Bitstream Vera Sans", sans-serif;
15+
margin-top: 50px;
16+
}
17+
.lb-login-form {
18+
max-width: 400px;
19+
margin: 60px auto 20px auto;
20+
padding: 20px;
21+
border: 1px solid #eaeaea;
22+
border-radius: 5px;
23+
}
24+
</style>
25+
26+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
27+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
28+
<!--[if lt IE 9]>
29+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
30+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
31+
<![endif]-->
1832

19-
<div>
20-
<button type="submit">Login</button>
33+
</head>
34+
<body>
35+
<div class="container">
36+
<h1 class="text-center lb-login-title">LARAVEL BACKEND</h1>
37+
<div class="lb-login-form">
38+
@if($errors->first())
39+
<div class="alert alert-danger">
40+
{{$errors->first()}}
41+
</div>
42+
@endif
43+
<form method="POST" action="{{ route('backend.authManager.postLogin') }}">
44+
{!! csrf_field() !!}
45+
<div class="form-group">
46+
Email
47+
<input class="form-control" type="email" name="email" value="{{ old('email') }}">
48+
</div>
49+
<div class="form-group">
50+
Password
51+
<input class="form-control" type="password" name="password" id="password">
52+
</div>
53+
<div class="form-group">
54+
<input type="checkbox" name="remember"> Remember Me
55+
</div>
56+
<div class="form-group">
57+
<button class="btn btn-default" type="submit">Login</button>
58+
</div>
59+
</form>
2160
</div>
22-
</form>
61+
</div>
62+
</body>
63+
</html>

src/Darryldecode/Backend/Components/Auth/Views/password.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<form method="POST" action="{{config('backend.backend.base_url')}}/password/email">
1+
<form method="POST" action="/{{config('backend.backend.base_url')}}/password/email">
22
{!! csrf_field() !!}
33

44
<div>

src/Darryldecode/Backend/Components/Auth/Views/reset.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<form method="POST" action="{{config('backend.backend.base_url')}}/password/reset">
1+
<form method="POST" action="/{{config('backend.backend.base_url')}}/password/reset">
22
{!! csrf_field() !!}
33
<input type="hidden" name="token" value="{{ $token }}">
44

src/Darryldecode/Backend/Public/backend/cb/css/backend.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@font-face {
22
font-family: 'dancing_script';
3-
src: url('/cb/fonts/dancing-script/dancing_script-webfont.eot');
4-
src: url('/cb/fonts/dancing-script/dancing_script-webfont.eot?#iefix') format('embedded-opentype'),
5-
url('/cb/fonts/dancing-script/dancing_script-webfont.woff') format('woff'),
6-
url('/cb/fonts/dancing-script/dancing_script-webfont.ttf') format('truetype'),
7-
url('/cb/fonts/dancing-script/dancing_script-webfont.svg#ostrich_sansmedium') format('svg');
3+
src: url('/darryldecode/backend/cb/fonts/dancing-script/dancing_script-webfont.eot');
4+
src: url('/darryldecode/backend/cb/fonts/dancing-script/dancing_script-webfont.eot?#iefix') format('embedded-opentype'),
5+
url('/darryldecode/backend/cb/fonts/dancing-script/dancing_script-webfont.woff') format('woff'),
6+
url('/darryldecode/backend/cb/fonts/dancing-script/dancing_script-webfont.ttf') format('truetype'),
7+
url('/darryldecode/backend/cb/fonts/dancing-script/dancing_script-webfont.svg#ostrich_sansmedium') format('svg');
88
font-weight: normal;
99
font-style: normal;
1010
}

src/Darryldecode/Backend/Utility/Helpers.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,24 @@ public static function redirectLogin()
186186
{
187187
return redirect(config('backend.backend.base_url').'/'.config('backend.backend.login_route'));
188188
}
189+
190+
/**
191+
* returns the dashboard route
192+
*
193+
* @return string
194+
*/
195+
public static function getDashboardRoute()
196+
{
197+
return config('backend.backend.base_url').'/dashboard';
198+
}
199+
200+
/**
201+
* returns the login route
202+
*
203+
* @return string
204+
*/
205+
public static function getLoginRoute()
206+
{
207+
return trim(config('backend.backend.base_url'),'/').'/'.trim(config('backend.backend.login_route'),'/');
208+
}
189209
}

0 commit comments

Comments
 (0)