-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactions.js
executable file
·110 lines (92 loc) · 3.43 KB
/
actions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
$(document).ready(function() {
// this call sets up the connection requesting debug to the console,
// identify the username and password field names
// setup a 5minute access allowance
// use internal login support
var sacv5 = SafeAjax.safeAjax_v5.init({ // use post to increase request size
ajaxConnector: "./lib/safeAjax/saConnector.php"
,loginFirst: false ,handleLogin: true, sha1Logins: false
,debug: true ,notify: true ,duration: "5m"
});
// finding users
$("#findByEMail").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'findViaEmail':$("#findBy").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
$("#findByUsername").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'findViaUsername':$("#findBy").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
$("#findByUserId").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'findViaUserId':$("#findBy").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
$("#findByPwdResetHash").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'findViaPwdResetHash':$("#findBy").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
$("#findByPersistence").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'findViaPersistence':$("#findBy").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
// updating users
$("#updateIndexed").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'updateValue':$("#update").val(), 'updateIndexed':$("#updateKey").val(), 'userId':$("#update-UserId").val(), 'updatorId':$("#updatorId").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
$("#updateArbitrary").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'updateValue':$("#update").val(), 'updateArbitrary':$("#updateKey").val(), 'userId':$("#update-UserId").val(), 'updatorId':$("#updatorId").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
// get password reset hash
$("#getPasswordResetHash").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'getPasswordResetHash':$("#get-UserId").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
// delete user
$("#deleteUser").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'deleteUser':1,'deletorId':$("#deletorId").val(), 'deleteUserId':$("#delete-UserId").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
// create user
$("#createUser").click(function(){
$(".aResult").empty();
sacv5.asyncRequest({'createUser':1,
'newEMail':$("#newEMail").val(),
'newUsername':$("#newUsername").val(),
'newPassword':$("#newPassword").val(),
'passwordSha1':$("#sha1:checked").size(),
'newAccess':$("#newAccess").val(),
'creatorId':$("#creatorId").val()},function(data){
$("#auth-result").html(JSON.stringify(data.auth));
$("#auth-err").html(data.authErr);
});
});
});