Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp-module-campusmultiauth
Manage
Activity
Members
Labels
Plan
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
simplesamlphp-module-campusmultiauth
Commits
aa861bef
Verified
Commit
aa861bef
authored
2 years ago
by
Pavel Břoušek
Browse files
Options
Downloads
Patches
Plain Diff
style: prettier
parent
61212c97
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
www/resources/campus-idp-muni.js
+1
-1
1 addition, 1 deletion
www/resources/campus-idp-muni.js
www/resources/campus-idp.js
+186
-182
186 additions, 182 deletions
www/resources/campus-idp.js
www/resources/privacyidea.js
+20
-20
20 additions, 20 deletions
www/resources/privacyidea.js
with
207 additions
and
203 deletions
www/resources/campus-idp-muni.js
+
1
−
1
View file @
aa861bef
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
()
{
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
()
{
App
.
run
({});
App
.
run
({});
});
});
This diff is collapsed.
Click to expand it.
www/resources/campus-idp.js
+
186
−
182
View file @
aa861bef
import
dialogPolyfill
from
"
dialog-polyfill
"
;
import
dialogPolyfill
from
"
dialog-polyfill
"
;
function
hideElement
(
element
)
{
function
hideElement
(
element
)
{
element
.
classList
.
add
(
"
vhide
"
,
"
d-none
"
);
element
.
classList
.
add
(
"
vhide
"
,
"
d-none
"
);
}
}
function
showElement
(
element
)
{
function
showElement
(
element
)
{
element
.
classList
.
remove
(
"
vhide
"
,
"
d-none
"
);
element
.
classList
.
remove
(
"
vhide
"
,
"
d-none
"
);
}
}
function
showMoreOptions
(
showButton
)
{
function
showMoreOptions
(
showButton
)
{
document
document
.
getElementById
(
showButton
.
dataset
.
targetform
)
.
getElementById
(
showButton
.
dataset
.
targetform
)
.
querySelectorAll
(
"
.idp-hidden
"
)
.
querySelectorAll
(
"
.idp-hidden
"
)
.
forEach
(
showElement
);
.
forEach
(
showElement
);
hideElement
(
showButton
);
hideElement
(
showButton
);
}
}
function
selectizeScore
()
{
function
selectizeScore
()
{
return
function
()
{
return
function
()
{
return
1
;
return
1
;
};
};
}
}
function
selectizeRenderOption
(
item
,
escape
)
{
function
selectizeRenderOption
(
item
,
escape
)
{
var
escapedText
=
escape
(
item
.
text
);
var
escapedText
=
escape
(
item
.
text
);
var
escapedImage
=
escape
(
item
.
image
);
var
escapedImage
=
escape
(
item
.
image
);
var
is_muni_framework
=
document
.
body
.
classList
.
contains
(
"
framework_muni
"
);
var
is_muni_framework
=
document
.
body
.
classList
.
contains
(
"
framework_muni
"
);
if
(
is_muni_framework
)
{
if
(
is_muni_framework
)
{
return
(
return
(
'
<div class="box-vcards-list__item box-vcard--compact searchbox-result u-pr-0 u-pl-0">
'
+
'
<div class="box-vcards-list__item box-vcard--compact searchbox-result u-pr-0 u-pl-0">
'
+
'
<div class="box-vcards-list__inner u-pr-0 u-pl-0">
'
+
'
<div class="box-vcards-list__inner u-pr-0 u-pl-0">
'
+
'
<p class="box-vcards-list__img center">
'
+
'
<p class="box-vcards-list__img center">
'
+
'
<img src="
'
+
'
<img src="
'
+
escapedImage
+
escapedImage
+
'
" class="img-searchbox" alt=""/>
'
+
'
" class="img-searchbox" alt=""/>
'
+
"
</p>
"
+
"
</p>
"
+
'
<div class="box-vcards-list__content u-pb-0 u-pt-0 u-pr-0 u-pl-10">
'
+
'
<div class="box-vcards-list__content u-pb-0 u-pt-0 u-pr-0 u-pl-10">
'
+
escapedText
+
escapedText
+
"
</div>
"
+
"
</div>
"
+
"
</div>
"
+
"
</div>
"
+
"
</div>
"
"
</div>
"
);
);
}
else
{
}
else
{
return
(
return
(
'
<div class="list-group-item list-group-item-action d-flex align-items-center">
'
+
'
<div class="list-group-item list-group-item-action d-flex align-items-center">
'
+
'
<p class="mb-0">
'
+
'
<p class="mb-0">
'
+
'
<img src="
'
+
'
<img src="
'
+
escapedImage
+
escapedImage
+
'
" class="img-searchbox" alt=""/>
'
+
'
" class="img-searchbox" alt=""/>
'
+
"
</p>
"
+
"
</p>
"
+
'
<div class="margin-left-24">
'
+
'
<div class="margin-left-24">
'
+
escapedText
+
escapedText
+
"
</div>
"
+
"
</div>
"
+
"
</div>
"
"
</div>
"
);
);
}
}
}
}
function
selectizeOnChange
(
value
)
{
function
selectizeOnChange
(
value
)
{
$
(
this
[
"
$input
"
]).
closest
(
"
form
"
).
trigger
(
"
submit
"
);
$
(
this
[
"
$input
"
]).
closest
(
"
form
"
).
trigger
(
"
submit
"
);
}
}
function
selectizeLoad
(
query
,
callback
)
{
function
selectizeLoad
(
query
,
callback
)
{
if
(
!
query
.
length
)
{
if
(
!
query
.
length
)
{
return
callback
();
return
callback
();
}
}
this
.
clearCache
(
"
option
"
);
this
.
clearCache
(
"
option
"
);
this
.
clearOptions
();
this
.
clearOptions
();
this
.
refreshOptions
(
true
);
this
.
refreshOptions
(
true
);
$
.
ajax
({
$
.
ajax
({
url
:
"
./idpSearch.php
"
,
url
:
"
./idpSearch.php
"
,
type
:
"
GET
"
,
type
:
"
GET
"
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
data
:
{
data
:
{
q
:
query
,
q
:
query
,
index
:
this
.
settings
.
myIndex
,
index
:
this
.
settings
.
myIndex
,
idphint
:
this
.
settings
.
idphint
,
idphint
:
this
.
settings
.
idphint
,
aarc_discovery_hint
:
this
.
settings
.
aarcDiscoveryHint
,
aarc_discovery_hint
:
this
.
settings
.
aarcDiscoveryHint
,
aarc_discovery_hint_uri
:
this
.
settings
.
aarcDiscoveryHintUri
,
aarc_discovery_hint_uri
:
this
.
settings
.
aarcDiscoveryHintUri
,
language
:
document
.
documentElement
.
getAttribute
(
"
lang
"
),
language
:
document
.
documentElement
.
getAttribute
(
"
lang
"
),
page_limit
:
10
,
page_limit
:
10
,
},
},
error
:
function
()
{
error
:
function
()
{
callback
();
callback
();
},
},
success
:
function
(
res
)
{
success
:
function
(
res
)
{
callback
(
res
.
items
);
callback
(
res
.
items
);
},
},
});
});
}
}
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
()
{
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
()
{
// show dialog after the specified timeout to refresh the page
// show dialog after the specified timeout to refresh the page
const
dialog
=
document
.
getElementById
(
"
refresh-required-dialog
"
);
const
dialog
=
document
.
getElementById
(
"
refresh-required-dialog
"
);
if
(
dialog
&&
dialog
.
dataset
.
timeout
)
{
if
(
dialog
&&
dialog
.
dataset
.
timeout
)
{
dialogPolyfill
.
registerDialog
(
dialog
);
dialogPolyfill
.
registerDialog
(
dialog
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
dialog
.
showModal
();
dialog
.
showModal
();
},
dialog
.
dataset
.
timeout
*
1000
);
},
dialog
.
dataset
.
timeout
*
1000
);
}
}
var
moreOptions
=
document
.
querySelectorAll
(
"
.more-options
"
);
var
moreOptions
=
document
.
querySelectorAll
(
"
.more-options
"
);
if
(
moreOptions
)
{
if
(
moreOptions
)
{
moreOptions
.
forEach
(
function
(
showButton
)
{
moreOptions
.
forEach
(
function
(
showButton
)
{
showButton
.
addEventListener
(
showButton
.
addEventListener
(
"
click
"
,
"
click
"
,
showMoreOptions
.
bind
(
null
,
showButton
)
showMoreOptions
.
bind
(
null
,
showButton
)
);
);
});
});
}
}
var
password
=
document
.
getElementById
(
"
password
"
);
var
password
=
document
.
getElementById
(
"
password
"
);
var
togglePassword
=
document
.
getElementById
(
"
toggle-password
"
);
var
togglePassword
=
document
.
getElementById
(
"
toggle-password
"
);
if
(
password
&&
togglePassword
)
{
if
(
password
&&
togglePassword
)
{
password
.
addEventListener
(
"
keyup
"
,
function
(
event
)
{
password
.
addEventListener
(
"
keyup
"
,
function
(
event
)
{
var
message
=
document
.
getElementById
(
"
capslock-warning
"
);
var
message
=
document
.
getElementById
(
"
capslock-warning
"
);
var
wrapper
=
document
.
getElementById
(
"
capslock-warning-wrapper
"
);
var
wrapper
=
document
.
getElementById
(
"
capslock-warning-wrapper
"
);
var
isCapsLock
=
event
.
getModifierState
(
"
CapsLock
"
);
var
isCapsLock
=
event
.
getModifierState
(
"
CapsLock
"
);
if
(
isCapsLock
)
{
if
(
isCapsLock
)
{
showElement
(
message
);
showElement
(
message
);
}
else
{
}
else
{
hideElement
(
message
);
hideElement
(
message
);
}
}
if
(
wrapper
)
{
if
(
wrapper
)
{
wrapper
.
classList
.
toggle
(
"
warning
"
,
isCapsLock
);
wrapper
.
classList
.
toggle
(
"
warning
"
,
isCapsLock
);
}
}
});
});
togglePassword
.
addEventListener
(
"
click
"
,
function
()
{
togglePassword
.
addEventListener
(
"
click
"
,
function
()
{
var
type
=
var
type
=
password
.
getAttribute
(
"
type
"
)
===
"
password
"
?
"
text
"
:
"
password
"
;
password
.
getAttribute
(
"
type
"
)
===
"
password
"
?
"
text
"
:
"
password
"
;
password
.
setAttribute
(
"
type
"
,
type
);
password
.
setAttribute
(
"
type
"
,
type
);
this
.
classList
.
toggle
(
"
icon-eye-slash
"
);
this
.
classList
.
toggle
(
"
icon-eye-slash
"
);
this
.
querySelector
(
"
i
"
).
classList
.
toggle
(
"
fa-eye
"
);
this
.
querySelector
(
"
i
"
).
classList
.
toggle
(
"
fa-eye
"
);
this
.
querySelector
(
"
i
"
).
classList
.
toggle
(
"
fa-eye-slash
"
);
this
.
querySelector
(
"
i
"
).
classList
.
toggle
(
"
fa-eye-slash
"
);
});
});
}
}
document
.
querySelectorAll
(
"
.remove-option
"
).
forEach
(
function
(
element
)
{
document
.
querySelectorAll
(
"
.remove-option
"
).
forEach
(
function
(
element
)
{
element
.
addEventListener
(
"
click
"
,
function
(
e
)
{
element
.
addEventListener
(
"
click
"
,
function
(
e
)
{
e
.
stopPropagation
();
e
.
stopPropagation
();
let
button
=
this
.
parentElement
.
parentElement
;
let
button
=
this
.
parentElement
.
parentElement
;
$
.
ajax
({
$
.
ajax
({
url
:
"
./removeCookie.php
"
,
url
:
"
./removeCookie.php
"
,
type
:
"
POST
"
,
type
:
"
POST
"
,
data
:
{
data
:
{
entityid
:
button
.
value
,
entityid
:
button
.
value
,
},
},
});
});
button
.
remove
();
button
.
remove
();
});
});
});
});
document
.
querySelectorAll
(
"
.idps-form-nojs-div
"
).
forEach
(
hideElement
);
document
.
querySelectorAll
(
"
.idps-form-nojs-div
"
).
forEach
(
hideElement
);
document
.
querySelectorAll
(
"
.idps-form-div
"
).
forEach
(
showElement
);
document
.
querySelectorAll
(
"
.idps-form-div
"
).
forEach
(
showElement
);
var
indexes
=
JSON
.
parse
(
var
indexes
=
JSON
.
parse
(
document
.
querySelector
(
'
meta[name="searchbox-indexes"]
'
).
content
document
.
querySelector
(
'
meta[name="searchbox-indexes"]
'
).
content
);
);
var
placeholderTexts
=
JSON
.
parse
(
var
placeholderTexts
=
JSON
.
parse
(
document
.
querySelector
(
'
meta[name="searchbox-placeholders"]
'
).
content
document
.
querySelector
(
'
meta[name="searchbox-placeholders"]
'
).
content
);
);
var
defaultPlaceholder
=
document
.
querySelector
(
var
defaultPlaceholder
=
document
.
querySelector
(
'
meta[name="searchbox-default"]
'
'
meta[name="searchbox-default"]
'
).
content
;
).
content
;
var
is_muni_framework
=
document
.
body
.
classList
.
contains
(
"
framework_muni
"
);
var
is_muni_framework
=
document
.
body
.
classList
.
contains
(
"
framework_muni
"
);
indexes
.
forEach
(
function
(
index
)
{
indexes
.
forEach
(
function
(
index
)
{
$
(
"
#searchbox-
"
+
index
).
selectize
({
$
(
"
#searchbox-
"
+
index
).
selectize
({
valueField
:
"
idpentityid
"
,
valueField
:
"
idpentityid
"
,
labelField
:
"
text
"
,
labelField
:
"
text
"
,
options
:
[],
options
:
[],
create
:
false
,
create
:
false
,
maxItems
:
1
,
maxItems
:
1
,
myIndex
:
index
,
myIndex
:
index
,
idphint
:
JSON
.
parse
(
idphint
:
JSON
.
parse
(
document
.
querySelector
(
'
meta[name="idphint"]
'
).
content
document
.
querySelector
(
'
meta[name="idphint"]
'
).
content
),
),
aarcDiscoveryHint
:
document
.
querySelector
(
'
meta[name="aarc_discovery_hint"]
'
).
content
,
aarcDiscoveryHint
:
document
.
querySelector
(
aarcDiscoveryHintUri
:
document
.
querySelector
(
'
meta[name="aarc_discovery_hint_uri"]
'
).
content
,
'
meta[name="aarc_discovery_hint"]
'
loadThrottle
:
250
,
).
content
,
placeholder
:
placeholderTexts
[
index
]
??
defaultPlaceholder
,
aarcDiscoveryHintUri
:
document
.
querySelector
(
render
:
{
'
meta[name="aarc_discovery_hint_uri"]
'
option
:
selectizeRenderOption
,
).
content
,
},
loadThrottle
:
250
,
onChange
:
selectizeOnChange
,
placeholder
:
placeholderTexts
[
index
]
??
defaultPlaceholder
,
score
:
selectizeScore
,
render
:
{
load
:
selectizeLoad
,
option
:
selectizeRenderOption
,
});
},
if
(
is_muni_framework
)
{
onChange
:
selectizeOnChange
,
$
(
"
#searchbox-
"
+
index
+
"
-selectized
"
).
after
(
score
:
selectizeScore
,
'
<span class="icon icon-search"></span>
'
load
:
selectizeLoad
,
);
});
$
(
"
#searchbox-
"
+
index
+
"
-selectized
"
)
if
(
is_muni_framework
)
{
.
parent
()
$
(
"
#searchbox-
"
+
index
+
"
-selectized
"
).
after
(
.
addClass
(
"
inp-fix inp-icon inp-icon--after
"
);
'
<span class="icon icon-search"></span>
'
}
);
});
$
(
"
#searchbox-
"
+
index
+
"
-selectized
"
)
.
parent
()
.
addClass
(
"
inp-fix inp-icon inp-icon--after
"
);
}
});
});
});
This diff is collapsed.
Click to expand it.
www/resources/privacyidea.js
+
20
−
20
View file @
aa861bef
const
closeMessage
=
(
e
)
=>
{
const
closeMessage
=
(
e
)
=>
{
e
.
target
.
parentElement
.
classList
.
add
(
"
hide
"
);
e
.
target
.
parentElement
.
classList
.
add
(
"
hide
"
);
e
.
preventDefault
();
e
.
preventDefault
();
return
false
;
return
false
;
};
};
document
.
addEventListener
(
"
DOMContentLoaded
"
,
()
=>
{
document
.
addEventListener
(
"
DOMContentLoaded
"
,
()
=>
{
// close buttons
// close buttons
document
.
querySelectorAll
(
"
.message__close
"
).
forEach
((
closeButton
)
=>
{
document
.
querySelectorAll
(
"
.message__close
"
).
forEach
((
closeButton
)
=>
{
closeButton
.
addEventListener
(
"
click
"
,
closeMessage
);
closeButton
.
addEventListener
(
"
click
"
,
closeMessage
);
});
});
// allow WebAuthn and OTP on one page
// allow WebAuthn and OTP on one page
[
"
otp
"
,
"
submitButton
"
].
forEach
((
id
)
=>
{
[
"
otp
"
,
"
submitButton
"
].
forEach
((
id
)
=>
{
const
el
=
document
.
getElementById
(
id
);
const
el
=
document
.
getElementById
(
id
);
if
(
el
)
{
if
(
el
)
{
el
.
classList
.
remove
(
"
hidden
"
);
el
.
classList
.
remove
(
"
hidden
"
);
}
}
});
});
const
piLoginForm
=
document
.
getElementById
(
"
piLoginForm
"
);
const
piLoginForm
=
document
.
getElementById
(
"
piLoginForm
"
);
if
(
piLoginForm
)
{
if
(
piLoginForm
)
{
piLoginForm
.
addEventListener
(
"
submit
"
,
()
=>
{
piLoginForm
.
addEventListener
(
"
submit
"
,
()
=>
{
document
.
getElementById
(
"
mode
"
).
value
=
"
otp
"
;
document
.
getElementById
(
"
mode
"
).
value
=
"
otp
"
;
});
});
}
}
});
});
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