Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Administrator
m4lab_landing_page
Commits
72edc658
Commit
72edc658
authored
5 years ago
by
Wolfgang Knopki
Browse files
Options
Download
Email Patches
Plain Diff
test dynamic header
parent
9dba8167
Pipeline
#120
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/headfoot.js
+14
-2
js/headfoot.js
with
14 additions
and
2 deletions
+14
-2
js/headfoot.js
+
14
-
2
View file @
72edc658
...
@@ -10,7 +10,6 @@ function prependChild(parent,child){
...
@@ -10,7 +10,6 @@ function prependChild(parent,child){
parent
.
insertBefore
(
child
,
parent
.
childNodes
[
0
]);
parent
.
insertBefore
(
child
,
parent
.
childNodes
[
0
]);
}
}
console
.
log
(
document
.
getElementById
(
'
loginswitch
'
).
getAttribute
(
'
authenticated
'
));
function
userAuthenticated
(){
function
userAuthenticated
(){
let
params
=
new
URLSearchParams
(
window
.
location
.
search
);
let
params
=
new
URLSearchParams
(
window
.
location
.
search
);
if
(
params
.
get
(
'
isAuthenticatedUser
'
)){
if
(
params
.
get
(
'
isAuthenticatedUser
'
)){
...
@@ -21,6 +20,18 @@ function userAuthenticated(){
...
@@ -21,6 +20,18 @@ function userAuthenticated(){
return
false
;
return
false
;
}
}
}
}
function
sendRequest
(
URL
){
let
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"
POST
"
,
URL
,
true
);
let
token
=
$
(
"
meta[name='_csrf']
"
).
attr
(
"
content
"
);
//Send the proper header information along with the request
xhr
.
setRequestHeader
(
'
X-CSRF-TOKEN
'
,
token
);
xhr
.
send
();
}
/* function head()
/* function head()
* creates header and prepends it to the documents body
* creates header and prepends it to the documents body
*/
*/
...
@@ -95,7 +106,8 @@ function head(){
...
@@ -95,7 +106,8 @@ function head(){
headlink
.
innerHTML
=
"
Account
"
;
headlink
.
innerHTML
=
"
Account
"
;
headlink
.
href
=
"
/account/
"
;
headlink
.
href
=
"
/account/
"
;
}
else
if
(
document
.
getElementById
(
'
loginswitch
'
).
getAttribute
(
'
authenticated
'
)
==
'
2
'
){
}
else
if
(
document
.
getElementById
(
'
loginswitch
'
).
getAttribute
(
'
authenticated
'
)
==
'
2
'
){
headlink
.
href
=
"
./logout
"
;
headlink
.
onclick
=
"
sendRequest('./logout');
"
;
headlink
.
href
=
"
#
"
;
headlink
.
innerHTML
=
"
Logout
"
;
headlink
.
innerHTML
=
"
Logout
"
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets