Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mycard Mobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mycard Mobile
Commits
147d139f
Commit
147d139f
authored
Aug 27, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loginUser thing
parent
e4b54a0a
Pipeline
#16062
passed with stages
in 6 minutes and 25 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
4 deletions
+11
-4
src/app/auth.guard.ts
src/app/auth.guard.ts
+3
-2
src/app/login.service.ts
src/app/login.service.ts
+6
-2
src/app/ygopro.service.ts
src/app/ygopro.service.ts
+1
-0
src/typings.d.ts
src/typings.d.ts
+1
-0
No files found.
src/app/auth.guard.ts
View file @
147d139f
...
...
@@ -13,10 +13,11 @@ export class AuthGuard implements CanActivateChild {
return
true
;
}
const
token
=
state
.
root
.
queryParamMap
.
get
(
'
sso
'
)
||
new
URL
(
location
.
href
).
searchParams
.
get
(
'
sso
'
)
||
localStorage
.
getItem
(
'
login
'
);
const
tokenFromSSO
=
state
.
root
.
queryParamMap
.
get
(
'
sso
'
)
||
new
URL
(
location
.
href
).
searchParams
.
get
(
'
sso
'
);
const
token
=
tokenFromSSO
||
localStorage
.
getItem
(
'
login
'
);
if
(
token
)
{
this
.
login
.
callback
(
token
);
this
.
login
.
callback
(
token
,
!!
tokenFromSSO
);
return
true
;
}
else
{
location
.
replace
(
this
.
login
.
login
());
...
...
src/app/login.service.ts
View file @
147d139f
...
...
@@ -56,7 +56,7 @@ export class LoginService {
return
url
.
toString
();
}
callback
(
token
:
string
)
{
callback
(
token
:
string
,
isNewLogin
:
boolean
)
{
this
.
token
=
token
;
this
.
user
=
<
any
>
fromPairs
(
Array
.
from
(
new
URLSearchParams
(
Buffer
.
from
(
token
,
'
base64
'
).
toString
())));
Raven
.
setUserContext
({
...
...
@@ -67,7 +67,11 @@ export class LoginService {
localStorage
.
setItem
(
'
login
'
,
token
);
if
(
window
.
ygopro
)
{
try
{
window
.
ygopro
.
updateUser
(
this
.
user
.
username
,
this
.
user
.
avatar_url
,
this
.
user
.
email
);
if
(
isNewLogin
&&
window
.
ygopro
.
loginUser
)
{
window
.
ygopro
.
loginUser
(
this
.
user
,
null
);
}
else
{
window
.
ygopro
.
updateUser
(
this
.
user
.
username
,
this
.
user
.
avatar_url
,
this
.
user
.
email
);
}
}
catch
(
error
)
{
console
.
error
(
error
);
}
...
...
src/app/ygopro.service.ts
View file @
147d139f
...
...
@@ -21,6 +21,7 @@ export interface User {
moderator
:
boolean
;
name
:
string
;
username
:
string
;
token
:
string
;
}
export
interface
Room
{
...
...
src/typings.d.ts
View file @
147d139f
...
...
@@ -16,6 +16,7 @@ interface Window {
backHome
():
void
;
share
(
text
:
string
):
void
updateUser
(
name
:
string
,
avatar
:
string
,
status
:
string
):
void
;
loginUser
(
user
:
any
,
exception
:
any
):
void
;
readFile
(
path
:
string
):
string
;
writeFile
(
path
:
string
,
data
:
string
):
string
;
...
...
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