Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3638edfd
authored
Oct 31, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
登陆接口
parent
68fbc65c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
17 deletions
.idea/workspace.xml
app/Http/Controllers/Api/AuthApiController.php
routes/api.php
routes/web.php
.idea/workspace.xml
View file @
3638edfd
...
...
@@ -3,6 +3,9 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"fb90add0-1393-48c2-9f26-72365d42cd03"
name=
"变更"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/routes/api.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/routes/api.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/routes/web.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/routes/web.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/storage/app/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/storage/app/.gitignore"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/storage/app/public/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/storage/app/public/.gitignore"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/storage/framework/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/storage/framework/.gitignore"
afterDir=
"false"
/>
...
...
app/Http/Controllers/Api/AuthApiController.php
View file @
3638edfd
...
...
@@ -8,6 +8,7 @@ use Illuminate\Foundation\Auth\ThrottlesLogins;
use
Illuminate\Foundation\Bus\DispatchesJobs
;
use
Illuminate\Foundation\Validation\ValidatesRequests
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
class
AuthApiController
extends
Controller
{
...
...
@@ -16,22 +17,25 @@ class AuthApiController extends Controller
public
function
login
(
Request
$request
)
{
$this
->
validateLogin
(
$request
);
if
(
method_exists
(
$this
,
'hasTooManyLoginAttempts'
)
&&
$this
->
hasTooManyLoginAttempts
(
$request
))
{
$this
->
fireLockoutEvent
(
$request
);
return
$this
->
sendLockoutResponse
(
$request
);
$validator
=
Validator
::
make
(
$request
->
all
(),
[
'email'
=>
'required|string|email|max:255'
,
'password'
=>
'required|string|min:8|confirmed'
,
],
[
'password.min'
=>
'Password must be at least 8 characters long.'
]);
if
(
$validator
->
fails
())
{
return
$this
->
setError
(
$validator
->
errors
()
->
first
());
}
if
(
$this
->
attemptLogin
(
$request
))
{
return
$this
->
sendLoginResponse
(
$request
);
$request
->
session
()
->
regenerate
();
return
$this
->
setSuccess
(
'login success'
);
}
$this
->
incrementLoginAttempts
(
$request
);
return
$this
->
se
ndFailedLoginResponse
(
$request
);
return
$this
->
se
tError
(
'login failure'
);
}
}
routes/api.php
View file @
3638edfd
...
...
@@ -14,8 +14,11 @@ use Illuminate\Support\Facades\Route;
|
*/
Route
::
middleware
([
'auth.api'
])
->
group
(
function
()
{
Route
::
get
(
'/user'
,
function
(
Request
$request
)
{
return
$request
->
user
();
});
Route
::
middleware
([])
->
namespace
(
'Api'
)
->
group
(
function
()
{
Route
::
POST
(
'/user/login'
,
'AuthApiController@login'
);
});
//Route::middleware(['auth'])->namespace('Api')->group(function () {
// Route::POST('/user/login', 'AuthApiController@login');
//});
routes/web.php
View file @
3638edfd
...
...
@@ -14,12 +14,15 @@ use Illuminate\Support\Facades\Route;
|
*/
Auth
::
routes
([
'verify'
=>
true
]);
//
Auth::routes(['verify' => true]);
Route
::
get
(
'/'
,
'HomeController@index'
)
->
name
(
'home'
);
Route
::
middleware
([
'auth'
])
->
group
(
function
()
{
Route
::
get
(
'/test'
,
function
()
{
return
'Test Page'
;
});
});
Route
::
get
(
'/'
,
'HomeController@index'
)
->
name
(
'home'
);
Route
::
get
(
'/forget'
,
'AuthController@forget'
)
->
name
(
'forget'
);
Route
::
get
(
'/about/company'
,
'AboutController@company'
)
->
name
(
'about.company'
);
Route
::
get
(
'/about/certification'
,
'AboutController@certification'
)
->
name
(
'about.certification'
);
//Route::get('/', 'HomeController@index')->name('home')->middleware('verified');
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