This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccount/resources/views/account/login.php

46 lines
1.8 KiB
PHP
Raw Normal View History

2019-04-24 18:46:41 +00:00
<?php include(__DIR__."/../layout/top.php"); ?>
<div class="row">
<div class="col-md-12">
<h3>Register</h3>
<?php if(!empty($msg)) { ?>
<div class="alert alert-warning" role="alert">
<?php echo $msg; ?>
</div>
<?php } ?>
<form method="post" id="login">
<b>Username:</b> <span id="msg_username"></span>
<input name="username" placeholder="Username" class="form-control">
<b>Password:</b> <span id="msg_password"></span>
<input name="password" type="password" placeholder="Password" class="form-control">
<input type="submit" class="btn btn-success" value="Login" style="margin-top: 10px;">
</form>
</div>
</div>
<script language="JavaScript">
$(document).ready(function () {
console.log("READY");
$("#login").submit(function (e) {
e.preventDefault();
var form = $(this);
$.ajax({
type: "POST",
url: "/gui/login",
data: form.serialize(), // serializes the form's elements.
success: function (data) {
window.location.href = "/";
},
error: function (data) {
if(data.status == 422) {
$.each(data.responseJSON, function( key, value ) {
$("#msg_"+key).html(value[0]);
});
}
if(data.status == 401) {
alert("Usernamme/Password falsch");
}
}
});
});
});
</script>
<?php include(__DIR__."/../layout/bottom.php"); ?>