forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.load.php
126 lines (110 loc) · 3.8 KB
/
home.load.php
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
*
* @file home.load.php
* @author Nils Laumaillé
* @version 2.1.23
* @copyright (c) 2009-2015 Nils Laumaillé
* @licensing GNU AFFERO GPL 3.0
* @link http://www.teampass.net
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] != 1) {
die('Hacking attempt...');
}
?>
<script type="text/javascript">
$(function() {
//build nice buttonset
$("#radio_import_type, #connect_ldap_mode").buttonset();
$("#personal_sk, #change_personal_sk, #reset_personal_sk, #pickfiles_csv, #pickfiles_kp").button();
if ($("#personal_saltkey_set").val() != 1) {
$("#change_personal_sk").button("disable");
}
//only numerics
$(".numeric_only").numeric();
//Simulate a CRON activity
$.post(
"sources/main.queries.php",
{
type : "send_wainting_emails"
},
function(data) {
//
}
);
});
function ChangeMyPass()
{
if ($("#new_pw").val() != "" && $("#new_pw").val() == $("#new_pw2").val()) {
if ($("#pw_strength_value").val() >= $("#user_pw_complexity").val()) {
var data = "{\"new_pw\":\""+sanitizeString($("#new_pw").val())+"\"}";
$.post(
"sources/main.queries.php",
{
type : "change_pw",
change_pw_origine : "first_change",
complexity : $("#user_pw_complexity").val(),
data : prepareExchangedData(data, "encode", "<?php echo $_SESSION['key'];?>")
},
function(data) {
if (data[0].error == "complexity_level_not_reached") {
$("#new_pw, #new_pw2").val("");
$("#change_pwd_error").addClass("ui-state-error ui-corner-all").show().html("<span><?php echo $LANG['error_complex_not_enought'];?></span>");
} else {
document.main_form.submit();
}
},
"json"
);
} else {
$("#change_pwd_error").addClass("ui-state-error ui-corner-all").show().html("<?php echo $LANG['error_complex_not_enought'];?>");
}
} else {
$("#change_pwd_error").addClass("ui-state-error ui-corner-all").show().html("<?php echo $LANG['index_pw_error_identical'];?>");
}
}
function toggle_import_type(type)
{
if (type == "csv") {
$('#import_type_csv').show();
$('#import_type_keepass').hide();
$(".ui-dialog-buttonpane button:contains('<?php echo $LANG['import_button'];?>')").button("enable");
} else {
$('#import_type_csv').hide();
$('#import_type_keepass').show();
$(".ui-dialog-buttonpane button:contains('<?php echo $LANG['import_button'];?>')").button("disable");
}
}
//Toggle details importation
function toggle_importing_details()
{
$("#div_importing_kp_details").toggle();
}
//PRINT OUT: select folders
function print_out_items()
{
$("#selected_folders").empty();
$("#loading_folders_wait").show();
//Lauchn ajax query that will build the select list
$.post(
"sources/main.queries.php",
{
type : "get_folders_list",
div_id : "selected_folders"
},
function(data) {
data = $.parseJSON(data);
for (reccord in data) {
$("#selected_folders").append("<option value='"+reccord+"'>"+data[reccord]+"</option>");
}
$("#loading_folders_wait").hide();
}
);
//Open dialogbox
$("#div_print_out").dialog("open");
}
</script>