46 lines
No EOL
1.8 KiB
PHP
46 lines
No EOL
1.8 KiB
PHP
<?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"); ?>
|