Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
01dab2cb
Commit
01dab2cb
authored
7 years ago
by
Kevin Lee
Browse files
Options
Downloads
Patches
Plain Diff
suggest name from ret jwt first (if it exists), but allow user to change it
parent
c1239854
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/index.js
+7
-11
7 additions, 11 deletions
src/index.js
src/utils.js
+4
-2
4 additions, 2 deletions
src/utils.js
with
11 additions
and
13 deletions
src/index.js
+
7
−
11
View file @
01dab2cb
...
@@ -77,17 +77,13 @@ window.App = {
...
@@ -77,17 +77,13 @@ window.App = {
}
}
let
username
;
let
username
;
// const jwt = getCookie("jwt");
const
jwt
=
getCookie
(
"
jwt
"
);
// if (jwt) {
if
(
jwt
)
{
// const data = parseJwt(jwt);
const
data
=
parseJwt
(
jwt
);
// username = data.typ.name;
username
=
data
.
typ
.
name
;
// alert("Your username is: " + username);
}
// } else {
username
=
qs
.
name
;
username
=
promptForName
(
username
);
// promptForName is blocking
if
(
!
username
)
{
username
=
promptForName
(
username
);
// promptForName is blocking
}
// }
const
myNametag
=
document
.
querySelector
(
"
#player-rig .nametag
"
);
const
myNametag
=
document
.
querySelector
(
"
#player-rig .nametag
"
);
myNametag
.
setAttribute
(
"
text
"
,
"
value
"
,
username
);
myNametag
.
setAttribute
(
"
text
"
,
"
value
"
,
username
);
...
...
This diff is collapsed.
Click to expand it.
src/utils.js
+
4
−
2
View file @
01dab2cb
...
@@ -166,8 +166,10 @@ export function generateName() {
...
@@ -166,8 +166,10 @@ export function generateName() {
return
name
.
replace
(
/^./
,
name
[
0
].
toUpperCase
());
return
name
.
replace
(
/^./
,
name
[
0
].
toUpperCase
());
}
}
export
function
promptForName
()
{
export
function
promptForName
(
username
)
{
var
username
=
generateName
();
if
(
!
username
)
username
=
generateName
();
do
{
do
{
username
=
prompt
(
"
Choose a username
"
,
username
);
username
=
prompt
(
"
Choose a username
"
,
username
);
}
while
(
!
(
username
&&
username
.
length
));
}
while
(
!
(
username
&&
username
.
length
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment