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
64fa34fc
authored
Nov 11, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
cookie信息
parent
abd66141
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
.idea/workspace.xml
app/Http/Controllers/Api/AuthApiController.php
app/Http/Middleware/AddExtraDataToCookie.php
app/Http/Middleware/EncryptCookies.php
.idea/workspace.xml
View file @
64fa34fc
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"fb90add0-1393-48c2-9f26-72365d42cd03"
name=
"变更"
comment=
""
>
<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$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Kernel.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Kernel.php"
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$/app/Http/Middleware/AddExtraDataToCookie.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Middleware/AddExtraDataToCookie.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Middleware/EncryptCookies.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Middleware/EncryptCookies.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/bootstrap/app.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/bootstrap/app.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/bootstrap/app.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/bootstrap/app.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/bootstrap/cache/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/bootstrap/cache/.gitignore"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/bootstrap/cache/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/bootstrap/cache/.gitignore"
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/.gitignore"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/storage/app/.gitignore"
afterDir=
"false"
/>
...
@@ -187,7 +189,8 @@
...
@@ -187,7 +189,8 @@
<workItem
from=
"1666835076791"
duration=
"693000"
/>
<workItem
from=
"1666835076791"
duration=
"693000"
/>
<workItem
from=
"1667266026118"
duration=
"40321000"
/>
<workItem
from=
"1667266026118"
duration=
"40321000"
/>
<workItem
from=
"1667959054458"
duration=
"183000"
/>
<workItem
from=
"1667959054458"
duration=
"183000"
/>
<workItem
from=
"1667986756173"
duration=
"13398000"
/>
<workItem
from=
"1667986756173"
duration=
"14315000"
/>
<workItem
from=
"1668150640953"
duration=
"889000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
...
...
app/Http/Controllers/Api/AuthApiController.php
View file @
64fa34fc
...
@@ -7,7 +7,9 @@ use App\Models\UserModel;
...
@@ -7,7 +7,9 @@ use App\Models\UserModel;
use
Illuminate\Foundation\Auth\RegistersUsers
;
use
Illuminate\Foundation\Auth\RegistersUsers
;
use
Illuminate\Foundation\Auth\ThrottlesLogins
;
use
Illuminate\Foundation\Auth\ThrottlesLogins
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Response
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Cookie
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Mail
;
use
Illuminate\Support\Facades\Mail
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Support\Facades\Redis
;
...
@@ -58,6 +60,7 @@ class AuthApiController extends Controller
...
@@ -58,6 +60,7 @@ class AuthApiController extends Controller
if
(
$this
->
attemptLogin
(
$request
))
{
if
(
$this
->
attemptLogin
(
$request
))
{
$request
->
session
()
->
regenerate
();
$request
->
session
()
->
regenerate
();
Cookie
::
queue
(
'sem_email'
,
Auth
::
user
()
->
email
,
config
(
'session.lifetime'
));
return
$this
->
setSuccess
(
'Login success'
);
return
$this
->
setSuccess
(
'Login success'
);
}
}
...
...
app/Http/Middleware/AddExtraDataToCookie.php
View file @
64fa34fc
...
@@ -4,6 +4,8 @@ namespace App\Http\Middleware;
...
@@ -4,6 +4,8 @@ namespace App\Http\Middleware;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Closure
;
use
Closure
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Cookie
;
class
AddExtraDataToCookie
class
AddExtraDataToCookie
{
{
...
@@ -16,13 +18,12 @@ class AddExtraDataToCookie
...
@@ -16,13 +18,12 @@ class AddExtraDataToCookie
*/
*/
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
)
{
{
if
(
!
cookie
(
'sem_gid'
))
{
if
(
empty
(
$_COOKIE
[
'sem_gid'
]
))
{
$time
=
Carbon
::
now
()
->
addYear
()
->
timestamp
;
$time
=
Carbon
::
now
()
->
addYear
()
->
timestamp
;
$gidKey
=
'5aEVuH0OzvnY8G5a'
;
$gidKey
=
'5aEVuH0OzvnY8G5a'
;
$gid
=
md5
(
time
()
.
$gidKey
.
$time
);
$gid
=
md5
(
time
()
.
$gidKey
.
$time
);
setcookie
(
'sem_gid'
,
$gid
,
$time
);
setcookie
(
'sem_gid'
,
$gid
,
$time
);
}
}
return
$next
(
$request
);
return
$next
(
$request
);
}
}
}
}
app/Http/Middleware/EncryptCookies.php
View file @
64fa34fc
...
@@ -13,5 +13,6 @@ class EncryptCookies extends Middleware
...
@@ -13,5 +13,6 @@ class EncryptCookies extends Middleware
*/
*/
protected
$except
=
[
protected
$except
=
[
//
//
'sem_email'
,
];
];
}
}
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