Revize 91ae594f
Přidáno uživatelem Ondřej Anděl před více než 3 roky(ů)
application/view/modals/loginModal.html | ||
---|---|---|
27 | 27 |
</div> |
28 | 28 |
<div class="modal-footer"> |
29 | 29 |
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="login()">Přihlásit se</button> |
30 |
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="register()">Zavřít</button>
|
|
30 |
<button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button> |
|
31 | 31 |
</div> |
32 | 32 |
</div> |
33 | 33 |
</div> |
34 | 34 |
</div> |
35 | 35 |
|
36 | 36 |
<script> |
37 |
function register(){ |
|
38 |
var data = new FormData(); |
|
39 |
data.append("user", 'beznyuser'); |
|
40 |
data.append("password", 'beznyuser'); |
|
41 |
data.append("role", 'editor'); |
|
42 |
let xhr = new XMLHttpRequest(); |
|
43 |
xhr.open("POST", "controller/RegistrationController.php"); |
|
44 |
xhr.send(data); |
|
45 |
} |
|
46 |
|
|
47 | 37 |
function login(){ |
48 | 38 |
var data = new FormData(); |
49 | 39 |
data.append("username", document.getElementById('nick').value); |
... | ... | |
52 | 42 |
xhr.open("POST", "controller/LoginController.php"); |
53 | 43 |
xhr.onload = function(){ |
54 | 44 |
if(this.response == 'Incorrect username and/or password!'){ //login was not successful, show modal |
55 |
$("#invalidlogin-modal").modal("show"); |
|
45 |
$("#invalid-login-modal").modal("show");
|
|
56 | 46 |
}else{ //login was successful, refresh page to apply changes in visible items |
57 | 47 |
location.reload(); |
58 | 48 |
} |
Také k dispozici: Unified diff
Bug #8993: Upravit problémy na titulní stránce