This commit is contained in:
2021-12-25 23:17:47 -03:00
parent 7e01974ec8
commit d7d671fb51
68 changed files with 2991 additions and 160 deletions

View File

@ -1,7 +1,7 @@
@extends('auth.base')
@section('content')
<form class="form-horizontal" action="{{url('', ['p' => 'auth', 'a' => 'do_login'])}}" method="post">
<form class="form-horizontal" id="login_form" method="post">
<div class="form-group">
<div class="col-md-2">Usuario</div>
<div class="col-md-3"><input type="text" name="name" class="form-control" /></div>
@ -15,3 +15,28 @@
</div>
</form>
@endsection
@push('scripts')
<script type="text/javascript">
function doLogin(e) {
e.preventDefault()
const form = $(e.currentTarget)
const url = '{{$urls->base}}/auth/login'
const data = {
name: form.find("[name='name']").val(),
password: form.find("[name='password']").val()
}
$.post(url, data).then((data) => {
if (data.login) {
window.location = '{{$route}}'
return
}
console.debug(data)
})
return false
}
$(document).ready(() => {
$('#login_form').submit(doLogin)
})
</script>
@endpush