Filippo Bertilotti
2024-07-22 0991a9fb42afabd45d2b7504b84d6484b241c35d
commit | author | age
9f6455 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
DC 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
3 <head>
4     <script src="{{asset('js/jquery/jquery-3.6.0.min.js')}}"></script>
5     <link href="{{asset('css/login.css?v=4')}}" rel="stylesheet" type="text/css">
6     <style type="text/css">
7         .c-half {
8             width: 50%;
9             float: left;
10             height: auto;
11         }
12
13         .c-box {
14             border: 1px solid black;
15             padding: 20px;
16             margin-bottom: 30px;
17         }
18
19         .grid {
20             padding: 50px 0px;
21         }
22         .vfa-red-title {
23             color: #e60000;
24             font-family: vodafone_ltregular, Arial, Helvetica, sans-serif;
25             font-size: 40px;
26             font-weight: normal;
27             text-align: center;
28             margin-bottom: 26px;
29             margin-top: 26px;
30             line-height: 42px;
31         }
55f8f9 32
DC 33         a {
34             text-decoration:underline;
35             display: block;
36         }
37
9f6455 38     </style>
DC 39 </head>
40
41 <body class="page_gray">
42
43 <div class="page_centerer">
44
45     <div class="grid">
46
55f8f9 47         <h1 class="vfa-red-title">Standalone FakeSSO Server</h1>
d5d253 48         <div class="c-box" id="status-info">
D 49             @if (isset($loggedInfo["logged"]) && $loggedInfo["logged"] == "1")
61313b 50                 <p><b>Login:</b>Loggato con account {{$loggedInfo["username"]}}</p>
D 51                 <p><b>Profilo</b> numero: {{str_replace("xno:", "", $loggedInfo["token"])}}</p>
52             @else
53                 <p><b>Login:</b> Non sei loggato</p>
d5d253 54             @endif
61313b 55             <p><b>Controllo cookie:</b> {{(isset($loggedInfo["message"])) ? $loggedInfo["message"] : 'OK'}}</p>
d5d253 56         </div>
9f6455 57
DC 58         <form id="fakesso" name="fakesso" action="" method="POST">
59             @csrf
60             <div class="c-box">
d2e4b7 61                 <h2>Seleziona il profilo SSO su cui vuoi loggarti</h2>
55f8f9 62                 <p>Il login utilizza i cookie a livello di dominio, risulterai loggato su tutti i portali che utilizzano il dominio attuale ({{$domain}}).</p>
9f6455 63                 <select id="sel_attiva">
DC 64                     @foreach (config('devtools.fake_sso_profiles') as $profileIndex => $profileContent)
ebf6bb 65                         <option value="{{$profileIndex}}">{{$profileIndex}} - {{$profileContent['name']}}</option>
9f6455 66                     @endforeach
DC 67                 </select>
68                 <input type="button" value="Attiva" id="btnAttiva"/>
69                 <div class="c-half"></div>
70             </div>
71             <div class="c-box">
d2e4b7 72                 <p>Elimina dalla sessione i cookie FakeSSO.</p>
9f6455 73                 <input type="button" value="Reset" id="btnReset"/>
DC 74
75             </div>
76         </form>
77         <div class="c-box">
d2e4b7 78             <a href="{{route('create-view')}}">Crea nuovo profilo sso</a>
DC 79         </div>
80         <div class="c-box">
81             <h2>Scorciatoie Portali</h2>
82             @foreach (config('custom.portals_shortcuts',[]) as $websiteName => $websiteUri)
55f8f9 83                 <a href="{{$websiteUri}}" target="_blank">{{$websiteName}}</a>
d2e4b7 84             @endforeach
9f6455 85         </div>
DC 86     </div>
87 </div>
88
89 <script type="text/javascript">
90     jQuery(document).ready(function () {
91         let authorizationToken = $('input[name="_token"]').val();
92
93         document.getElementById("btnAttiva").onclick = setCookies;
94         document.getElementById("btnReset").onclick = delCookies;
95
d5d253 96         function callAjax(url, isSet) {
9f6455 97             document.getElementById('vola-loading').style.display = 'block';
DC 98             let profile = document.getElementById('sel_attiva').value;
99             $.ajax({
100                 headers: {
101                     'X-CSRF-TOKEN': authorizationToken,
102                 },
103                 type: "POST",
104                 url: url,
105                 dataType: "json",
106                 data: JSON.stringify({prof: profile}),
107             }).done(function (msg) {
108                 document.getElementById('vola-loading').style.display = 'none';
61313b 109                 if (isSet) document.getElementById('status-info').innerHTML = '<b>Creati cookie per profilo xno:' + profile + '</b>';
9f6455 110             }).fail(function() {
DC 111                 document.getElementById('vola-loading').style.display = 'none';
112             });
113         }
114
115         function setCookies() {
116             let setUri = location.origin + "{{$setUrl}}";
d5d253 117             callAjax(setUri, true);
9f6455 118         }
DC 119
120         function delCookies() {
121             let logoutUri = location.origin + "{{$clearUrl}}";
d5d253 122             callAjax(logoutUri, false);
9f6455 123         }
DC 124
125     });
126 </script>
127
128 @include('vola_loading_animation')
129 </body>
130 </html>