Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
104 | daniel-mar | 1 | /* |
2 | * OIDplus 2.0 |
||
3 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
4 | * |
||
5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
6 | * you may not use this file except in compliance with the License. |
||
7 | * You may obtain a copy of the License at |
||
8 | * |
||
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
10 | * |
||
11 | * Unless required by applicable law or agreed to in writing, software |
||
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
14 | * See the License for the specific language governing permissions and |
||
15 | * limitations under the License. |
||
16 | */ |
||
17 | |||
18 | /* RA */ |
||
19 | |||
20 | function raLogout(email) { |
||
21 | if(!window.confirm("Are you sure that you want to logout?")) return false; |
||
22 | |||
23 | $.ajax({ |
||
24 | url:"action.php", |
||
25 | method:"POST", |
||
26 | data: { |
||
27 | action:"ra_logout", |
||
28 | email:email, |
||
29 | }, |
||
30 | success:function(data) { |
||
31 | if (data != "OK") { |
||
32 | alert("Error: " + data); |
||
33 | } else { |
||
34 | document.location = '?goto=oidplus:system'; |
||
35 | // reloadContent(); |
||
36 | } |
||
37 | } |
||
38 | }); |
||
39 | } |
||
40 | |||
41 | function raLogin(email, password) { |
||
42 | $.ajax({ |
||
43 | url:"action.php", |
||
44 | method:"POST", |
||
45 | data: { |
||
46 | action:"ra_login", |
||
47 | email:email, |
||
48 | password:password, |
||
49 | captcha: document.getElementsByClassName('g-recaptcha').length > 0 ? grecaptcha.getResponse() : null |
||
50 | }, |
||
51 | success:function(data) { |
||
52 | if (data != "OK") { |
||
53 | alert("Error: " + data); |
||
54 | grecaptcha.reset(); |
||
55 | } else { |
||
56 | document.location = '?goto=oidplus:system'; |
||
57 | // reloadContent(); |
||
58 | } |
||
59 | } |
||
60 | }); |
||
61 | } |
||
62 | |||
63 | function raLoginOnSubmit() { |
||
64 | raLogin(document.getElementById("raLoginEMail").value, document.getElementById("raLoginPassword").value); |
||
65 | return false; |
||
66 | } |
||
67 | |||
68 | /* Admin */ |
||
69 | |||
70 | function adminLogin(password) { |
||
71 | $.ajax({ |
||
72 | url:"action.php", |
||
73 | method:"POST", |
||
74 | data: { |
||
75 | action:"admin_login", |
||
76 | password:password, |
||
77 | captcha: document.getElementsByClassName('g-recaptcha').length > 0 ? grecaptcha.getResponse() : null |
||
78 | }, |
||
79 | success:function(data) { |
||
80 | if (data != "OK") { |
||
81 | alert("Error: " + data); |
||
82 | grecaptcha.reset(); |
||
83 | } else { |
||
84 | document.location = '?goto=oidplus:system'; |
||
85 | // reloadContent(); |
||
86 | } |
||
87 | } |
||
88 | }); |
||
89 | } |
||
90 | |||
91 | function adminLogout() { |
||
92 | if(!window.confirm("Are you sure that you want to logout?")) return false; |
||
93 | |||
94 | $.ajax({ |
||
95 | url:"action.php", |
||
96 | method:"POST", |
||
97 | data: { |
||
98 | action:"admin_logout", |
||
99 | }, |
||
100 | success:function(data) { |
||
101 | if (data != "OK") { |
||
102 | alert("Error: " + data); |
||
103 | } else { |
||
104 | document.location = '?goto=oidplus:system'; |
||
105 | // reloadContent(); |
||
106 | } |
||
107 | } |
||
108 | }); |
||
109 | } |
||
110 | |||
111 | function adminLoginOnSubmit() { |
||
112 | adminLogin(document.getElementById("adminLoginPassword").value); |
||
113 | return false; |
||
114 | } |