File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 88 {{> auth/auth-hidden-fields }}
99 </div >
1010</form >
11+
12+ <script type =" text/javascript" >
13+ const button = document .getElementById (' login-tls' )
14+ button .addEventListener (' click' , function (event ) {
15+ event .preventDefault ()
16+ fetch (' /login/tls' , { method: ' POST' , credentials: ' include' })
17+ .then (function (response ) {
18+ const webId = response .headers .get (' user' )
19+ const idp = new URL (webId).origin
20+ const session = { authType: ' WebID-TLS' , webId, idp }
21+ const authClientNamespace = ' solid-auth-client'
22+ let authClientStore
23+ try {
24+ authClientStore = JSON .parse (localStorage .getItem (authClientNamespace) || ' {}' )
25+ } catch (err) {
26+ authClientStore = {}
27+ }
28+ authClientStore .session = session
29+ localStorage .setItem (authClientNamespace, JSON .stringify (authClientStore))
30+ return response
31+ })
32+ .then (function (response ) {
33+ window .location .href = response .url
34+ })
35+ })
36+ </script >
You can’t perform that action at this time.
0 commit comments