bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
|
83.2.16
by elof.bigestans at gmail
* Merged trunk AND |
1 |
function loginHint(e) { |
2 |
e.preventDefault(); |
|
3 |
e.stopPropagation(); |
|
4 |
||
5 |
// If username field is empty, inform user and exit function |
|
6 |
var uname = $("#login #username").val(); |
|
7 |
if(uname == "") { |
|
8 |
alert("You have to enter a username to receive a password hint"); |
|
9 |
return; |
|
10 |
} |
|
11 |
||
12 |
// POST username to the function /ajax/pwdhint which returns a json object with password hint |
|
13 |
$.post( |
|
14 |
// Replace with final production URL!!! |
|
15 |
||
16 |
"ajax/pwdhint", |
|
17 |
// Data sent through POST |
|
18 |
{ username: uname }, |
|
19 |
||
20 |
// Callback function |
|
21 |
function(data) { |
|
22 |
var result = $.parseJSON(data)["hint"]; |
|
23 |
||
24 |
// result["hint"] is either a boolean false or a string containing the hint |
|
25 |
if(result === false) { |
|
26 |
$("#hinttext").html('<p class="error">No password hint available</p>'); |
|
27 |
} else { |
|
28 |
$("#hinttext").html('<p>Hint: ' + result + '</p>'); |
|
29 |
} |
|
30 |
||
31 |
$("#login").toggleClass("expanded"); |
|
32 |
$("#hinttext").toggle(); |
|
33 |
||
|
83.2.12
by elof.bigestans at gmail
* Merged trunk |
34 |
} |
|
83.2.16
by elof.bigestans at gmail
* Merged trunk AND |
35 |
); // End $.post {} |
36 |
||
37 |
} // End loginHint() |