Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
7b2b8fe9
Commit
7b2b8fe9
authored
Oct 17, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing laravel auth controllers
parent
e0c102b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
222 deletions
+0
-222
AuthController.php
app/Http/Controllers/Auth/AuthController.php
+0
-106
PasswordController.php
app/Http/Controllers/Auth/PasswordController.php
+0
-114
RouteServiceProvider.php
app/Providers/RouteServiceProvider.php
+0
-2
No files found.
app/Http/Controllers/Auth/AuthController.php
deleted
100755 → 0
View file @
e0c102b7
<?php
namespace
App\Http\Controllers\Auth
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Contracts\Auth\Guard
;
use
App\Http\Requests\Auth\LoginRequest
;
use
App\Http\Requests\Auth\RegisterRequest
;
/**
* @Middleware("guest", except={"logout"})
*/
class
AuthController
extends
Controller
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected
$auth
;
/**
* Create a new authentication controller instance.
*
* @param Guard $auth
* @return void
*/
public
function
__construct
(
Guard
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
* Show the application registration form.
*
* @Get("auth/register")
*
* @return Response
*/
public
function
showRegistrationForm
()
{
return
view
(
'auth.register'
);
}
/**
* Handle a registration request for the application.
*
* @Post("auth/register")
*
* @param RegisterRequest $request
* @return Response
*/
public
function
register
(
RegisterRequest
$request
)
{
// Registration form is valid, create user...
$this
->
auth
->
login
(
$user
);
return
redirect
(
'/'
);
}
/**
* Show the application login form.
*
* @Get("auth/login")
*
* @return Response
*/
public
function
showLoginForm
()
{
return
view
(
'auth.login'
);
}
/**
* Handle a login request to the application.
*
* @Post("auth/login")
*
* @param LoginRequest $request
* @return Response
*/
public
function
login
(
LoginRequest
$request
)
{
if
(
$this
->
auth
->
attempt
(
$request
->
only
(
'email'
,
'password'
)))
{
return
redirect
(
'/'
);
}
return
redirect
(
'/auth/login'
)
->
withErrors
([
'email'
=>
'These credentials do not match our records.'
,
]);
}
/**
* Log the user out of the application.
*
* @Get("auth/logout")
*
* @return Response
*/
public
function
logout
()
{
$this
->
auth
->
logout
();
return
redirect
(
'/'
);
}
}
app/Http/Controllers/Auth/PasswordController.php
deleted
100755 → 0
View file @
e0c102b7
<?php
namespace
App\Http\Controllers\Auth
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Contracts\Auth\PasswordBroker
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* @Middleware("guest")
*/
class
PasswordController
extends
Controller
{
/**
* The password broker implementation.
*
* @var PasswordBroker
*/
protected
$passwords
;
/**
* Create a new password controller instance.
*
* @param PasswordBroker $passwords
* @return void
*/
public
function
__construct
(
PasswordBroker
$passwords
)
{
$this
->
passwords
=
$passwords
;
}
/**
* Display the form to request a password reset link.
*
* @Get("password/email")
*
* @return Response
*/
public
function
showResetRequestForm
()
{
return
view
(
'password.email'
);
}
/**
* Send a reset link to the given user.
*
* @Post("password/email")
*
* @param Request $request
* @return Response
*/
public
function
sendResetLink
(
Request
$request
)
{
switch
(
$response
=
$this
->
passwords
->
sendResetLink
(
$request
->
only
(
'email'
)))
{
case
PasswordBroker
::
INVALID_USER
:
return
redirect
()
->
back
()
->
with
(
'error'
,
trans
(
$response
));
case
PasswordBroker
::
RESET_LINK_SENT
:
return
redirect
()
->
back
()
->
with
(
'status'
,
trans
(
$response
));
}
}
/**
* Display the password reset view for the given token.
*
* @Get("password/reset")
*
* @param string $token
* @return Response
*/
public
function
showResetForm
(
$token
=
null
)
{
if
(
is_null
(
$token
))
{
throw
new
NotFoundHttpException
;
}
return
view
(
'password.reset'
)
->
with
(
'token'
,
$token
);
}
/**
* Reset the given user's password.
*
* @Post("password/reset")
*
* @param Request $request
* @return Response
*/
public
function
resetPassword
(
Request
$request
)
{
$credentials
=
$request
->
only
(
'email'
,
'password'
,
'password_confirmation'
,
'token'
);
$response
=
$this
->
passwords
->
reset
(
$credentials
,
function
(
$user
,
$password
)
{
$user
->
password
=
bcrypt
(
$password
);
$user
->
save
();
});
switch
(
$response
)
{
case
PasswordBroker
::
INVALID_PASSWORD
:
case
PasswordBroker
::
INVALID_TOKEN
:
case
PasswordBroker
::
INVALID_USER
:
return
redirect
()
->
back
()
->
with
(
'error'
,
trans
(
$response
));
case
PasswordBroker
::
PASSWORD_RESET
:
return
redirect
()
->
to
(
'/'
);
}
}
}
app/Providers/RouteServiceProvider.php
View file @
7b2b8fe9
...
...
@@ -19,8 +19,6 @@ class RouteServiceProvider extends ServiceProvider {
*/
protected
$scan
=
[
'App\Http\Controllers\HomeController'
,
'App\Http\Controllers\Auth\AuthController'
,
'App\Http\Controllers\Auth\PasswordController'
,
];
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment