1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,65 @@ |
1 |
+/** |
|
2 |
+ * Copyright (C) 2021 Double Bastion LLC |
|
3 |
+ * |
|
4 |
+ * This file is part of Roundpin, which is licensed under the |
|
5 |
+ * GNU Affero General Public License Version 3.0. The license terms |
|
6 |
+ * are detailed in the "LICENSE.txt" file located in the root directory. |
|
7 |
+ */ |
|
8 |
+ |
|
9 |
+$(document).ready(function() { |
|
10 |
+ |
|
11 |
+ $("#emailforgotpass").focus(); |
|
12 |
+ |
|
13 |
+ $('#emailforgotpass').on('input', function() { |
|
14 |
+ if ($(this).val().length != 0) { |
|
15 |
+ $("#emailaddressfgtLabel").css({'display' : 'block', 'opacity' : '1'}); |
|
16 |
+ } else { $("#emailaddressfgtLabel").css('display','none'); } |
|
17 |
+ }); |
|
18 |
+ |
|
19 |
+ $("#forgotpassbutton").on("click", function() { |
|
20 |
+ |
|
21 |
+ // Verify if the email address is correctly formatted |
|
22 |
+ var emailforgotpreq = $("#emailforgotpass").val(); |
|
23 |
+ |
|
24 |
+ if (emailforgotpreq == '') { |
|
25 |
+ var messageEmail = "Please enter your email address !"; |
|
26 |
+ alert(messageEmail); |
|
27 |
+ } else if (/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(emailforgotpreq)) { |
|
28 |
+ var messageEmail = ''; |
|
29 |
+ } else { |
|
30 |
+ var messageEmail = "The email address is not valid !"; |
|
31 |
+ alert(messageEmail); |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ if (messageEmail == '') { |
|
35 |
+ |
|
36 |
+ $.ajax({ |
|
37 |
+ type: "POST", |
|
38 |
+ url: "regain-access.php", |
|
39 |
+ dataType: "JSON", |
|
40 |
+ data: { |
|
41 |
+ emailforgot: emailforgotpreq, |
|
42 |
+ messageToUser: messageEmail, |
|
43 |
+ verifyToken: getVerifyToken |
|
44 |
+ }, |
|
45 |
+ success: function(reqresponse) { |
|
46 |
+ if (reqresponse.result == 'success') { |
|
47 |
+ $("#submitmessage").empty(); |
|
48 |
+ $("#submitmessage").append("<span>"+reqresponse.messageonrequest+"</span>"); |
|
49 |
+ $("#submitmessage").css("color", "#10ba65"); |
|
50 |
+ } else { |
|
51 |
+ $("#submitmessage").empty(); |
|
52 |
+ $("#submitmessage").append("<span>"+reqresponse.messageonrequest+"</span>"); |
|
53 |
+ $("#submitmessage").css("color", "#AC1F23"); |
|
54 |
+ } |
|
55 |
+ }, |
|
56 |
+ error: function(reqresponse) { |
|
57 |
+ $("#submitmessage").empty(); |
|
58 |
+ $("#submitmessage").append("<span>An error occurred while processing data !</span>"); |
|
59 |
+ $("#submitmessage").css("color", "#AC1F23"); |
|
60 |
+ } |
|
61 |
+ |
|
62 |
+ }); |
|
63 |
+ } |
|
64 |
+ }); |
|
65 |
+}); |