Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDD97-Webprog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Oliver Green
TDDD97-Webprog
Commits
8972dbdd
Commit
8972dbdd
authored
2 years ago
by
Oliver Green
Browse files
Options
Downloads
Patches
Plain Diff
added login and signup token
parent
1b5acb7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client.js
+23
-3
23 additions, 3 deletions
client.js
with
23 additions
and
3 deletions
client.js
+
23
−
3
View file @
8972dbdd
...
...
@@ -19,6 +19,15 @@ window.onload = function() {
// You shall put your own custom code here.
// window alert() is not allowed to be used in your implementation.
//window.alert("Hello TDDD97!");
if
(
localStorage
.
getItem
(
"
logintoken
"
)
!=
null
)
{
loadProfileView
();
}
else
{
loadWelcomeView
();
}
};
loadWelcomeView
=
function
()
{
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
welcomeview
"
).
innerText
;
var
loginform
=
document
.
forms
[
"
loginform
"
];
var
signupform
=
document
.
forms
[
"
signupform
"
];
...
...
@@ -41,10 +50,13 @@ window.onload = function() {
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
""
;
document
.
getElementById
(
"
pagecontent
"
).
innerText
=
""
;
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
profileview
"
).
innerText
;
localStorage
.
setItem
(
"
logintoken
"
,
message
.
data
);
console
.
log
(
message
.
data
);
}
}
})
loginform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
if
(
inputValidation
(
"
loginform
"
))
{
...
...
@@ -58,11 +70,19 @@ window.onload = function() {
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
""
;
document
.
getElementById
(
"
pagecontent
"
).
innerText
=
""
;
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
profileview
"
).
innerText
;
localStorage
.
setItem
(
"
logintoken
"
,
message
.
data
);
console
.
log
(
message
.
data
);
}
}
})
};
}
loadProfileView
=
function
()
{
console
.
log
(
"
cookie loaded
"
);
console
.
log
(
localStorage
.
getItem
(
"
logintoken
"
));
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
profileview
"
).
innerText
;
}
inputValidation
=
function
(
formID
)
{
var
form
=
document
.
forms
[
formID
];
...
...
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