commit | author | age
|
48a649
|
1 |
|
U |
2 |
|
|
3 |
function um_prf_init() { |
|
4 |
$('#meldung-box').hide(); |
|
5 |
$('#anmeldename').hide(); |
|
6 |
$('.user-save-btn').click(um_prf_user_save); |
|
7 |
$('#logout').click(um_prf_apicall_logout); |
|
8 |
um_prf_apicall_get_login(); |
|
9 |
} |
|
10 |
|
|
11 |
function um_prf_user_form_fuellen(resp) { |
|
12 |
$('#anmeldename').text(resp.UserData.id); |
|
13 |
$('#vorname').val(resp.UserData.firstName); |
|
14 |
$('#nachname').val(resp.UserData.lastName); |
|
15 |
} |
|
16 |
|
|
17 |
function um_prf_user_save() { |
|
18 |
var uid = $('#anmeldename').text(); |
|
19 |
var aktKennwort = $('#kennwort').val(); |
|
20 |
var neuKennwort = $('#kennwortNeu').val(); |
|
21 |
var wKennwort = $('#kennwortw').val(); |
|
22 |
if(neuKennwort === '' || wKennwort === '') { |
|
23 |
um_prf_meldung_anzeigen('Das neue Kennwort darf nicht leer sein.'); |
|
24 |
} else if(neuKennwort !== wKennwort) { |
|
25 |
um_prf_meldung_anzeigen('Kennworte stimmen nicht überein'); |
|
26 |
} else if(aktKennwort === neuKennwort) { |
|
27 |
um_prf_meldung_anzeigen('Altes und neues Kennwort müssen sich unterscheiden'); |
|
28 |
} else { |
|
29 |
um_prf_apicall_kennwort_aendern(uid, aktKennwort, neuKennwort); |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
function um_prf_meldung_anzeigen(msg) { |
|
34 |
$('#meldung-box').show(); |
|
35 |
$("#mldg-x").on('click', function() { |
|
36 |
$("#mldg-x").attr('onclick','').unbind('click'); |
|
37 |
$('.meldung').slideUp('fast', function() { |
|
38 |
$('#meldung-box').hide(); |
|
39 |
}); |
|
40 |
}); |
|
41 |
$('.meldung').empty(); |
|
42 |
$('.meldung').text(msg); |
|
43 |
$('.meldung').slideDown('fast', function(){ |
|
44 |
// |
|
45 |
}); |
|
46 |
} |
|
47 |
|
|
48 |
|
|
49 |
function um_prf_apicall_get_login() { |
|
50 |
var m = '?c=de.uhilger.um.pub.SessionManager&m=getSessionUser'; |
|
51 |
var u = '../pub' + m; |
|
52 |
$.ajax({ |
|
53 |
url: u, |
|
54 |
type: "GET", |
|
55 |
dataType : "json", |
|
56 |
success: function( resp ) { |
|
57 |
$('#userMenu').text(resp.UserData.firstName); |
|
58 |
um_prf_user_form_fuellen(resp); |
|
59 |
}, |
|
60 |
error: function( xhr, status, errorThrown ) { |
|
61 |
$('#fehler').html("Error: " + errorThrown + " Status: " + status); |
|
62 |
}, |
|
63 |
complete: function( xhr, status ) { |
|
64 |
//alert( "The request is complete!" ); |
|
65 |
} |
|
66 |
}); |
|
67 |
|
|
68 |
} |
|
69 |
function um_prf_apicall_get_user() { |
|
70 |
var m = '?c=de.uhilger.um.api.Profil&m=getUser'; |
|
71 |
var u = '../prf' + m; |
|
72 |
$.ajax({ |
|
73 |
url: u, |
|
74 |
type: "GET", |
|
75 |
dataType : "json", |
|
76 |
success: function( resp ) { |
|
77 |
um_prf_user_form_fuellen(resp); |
|
78 |
}, |
|
79 |
error: function( xhr, status, errorThrown ) { |
|
80 |
$('#fehler').html("Error: " + errorThrown + " Status: " + status); |
|
81 |
}, |
|
82 |
complete: function( xhr, status ) { |
|
83 |
//alert( "The request is complete!" ); |
|
84 |
} |
|
85 |
}); |
|
86 |
} |
|
87 |
|
|
88 |
function um_prf_apicall_kennwort_aendern(userId, aktKw, neuKw) { |
|
89 |
var m = '?c=de.uhilger.um.api.Profil&m=setUserPw&p=' + userId + '&p=' + aktKw + '&p=' + neuKw; |
|
90 |
var u = '../prf' + m; |
|
91 |
$.ajax({ |
|
92 |
url: u, |
|
93 |
type: "GET", |
|
94 |
dataType : "text", |
|
95 |
success: function( resp ) { |
|
96 |
um_prf_meldung_anzeigen(resp); |
|
97 |
}, |
|
98 |
error: function( xhr, status, errorThrown ) { |
|
99 |
$('#fehler').html("Error: " + errorThrown + " Status: " + status); |
|
100 |
}, |
|
101 |
complete: function( xhr, status ) { |
|
102 |
//alert( "The request is complete!" ); |
|
103 |
} |
|
104 |
}); |
|
105 |
} |
|
106 |
|
|
107 |
function um_prf_apicall_logout() { |
|
108 |
var m = '?c=de.uhilger.um.pub.SessionManager&m=expireSession'; |
|
109 |
var u = '../pub' + m; |
|
110 |
$.ajax({ |
|
111 |
url: u, |
|
112 |
type: "GET", |
|
113 |
dataType : "text", |
|
114 |
success: function( resp ) { |
|
115 |
$('#userMenu').text('nicht angemeldet'); |
|
116 |
window.location.href = '../logout.html'; |
|
117 |
}, |
|
118 |
error: function( xhr, status, errorThrown ) { |
|
119 |
$('#fehler').html("Error: " + errorThrown + " Status: " + status); |
|
120 |
}, |
|
121 |
complete: function( xhr, status ) { |
|
122 |
//alert( "The request is complete!" ); |
|
123 |
} |
|
124 |
}); |
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|