Files
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user