Advertisement
Guest User

Untitled

a guest
Dec 25th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.81 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Login Absensi</title>
  6.  
  7.     <meta name="_token" content="{!! csrf_token() !!}">
  8.  
  9.     <link rel="stylesheet" href="{{ URL::asset('v/bootstrap/dist/css/bootstrap.min.css') }}">
  10.     <link rel="stylesheet" href="{{ URL::asset('v/datatables/datatables.min.css') }}">
  11.     <link rel="stylesheet" href="{{ URL::asset('v/font-awesome/css/font-awesome.min.css') }}">
  12.     <link rel="stylesheet" href="{{ URL::asset('css/main.css') }}">
  13.  
  14.     <script type="text/javascript" src="{{ URL::asset('v/jquery/jquery-3.3.1.min.js') }}"></script>
  15.     <script type="text/javascript" src="{{ URL::asset('v/datatables/datatables.min.js') }}"></script>
  16.     <script type="text/javascript" src="{{ URL::asset('v/bootstrap/dist/js/bootstrap.min.js') }}"></script>
  17. </head>
  18. <body>
  19.     <div class="container-fluid h-100">
  20.  
  21.         <div class="row h-100 justify-content-center align-items-center">
  22.             <div class="login-box col-md-4 col-sm-12 mt-5 mx-2 p-4">
  23.                 <h3 class="text-center">Absensi Online</h3>
  24.                 <h6 class="text-center text-muted">Silakan Login ke Akun Absensi</h6>
  25.  
  26.                 <div id="alert"></div>
  27.  
  28.                 <label for="username">Username</label>
  29.                 <div class="input-group mb-3">
  30.                     <div class="input-group-prepend">
  31.                         <span class="input-group-text rounded-0" id="basic-addon1"><i class="fa fa-user"></i></span>
  32.                     </div>
  33.                     <input type="text" class="form-control rounded-0" name="username" id="username" aria-label="username">
  34.                 </div>
  35.  
  36.                 <label for="username">Password</label>
  37.                 <div class="input-group mb-3">
  38.                     <div class="input-group-prepend">
  39.                         <span class="input-group-text rounded-0" id="basic-addon1"><i class="fa fa-lock"></i></span>
  40.                     </div>
  41.                     <input type="password" class="form-control rounded-0" name="password" id="password" aria-label="password">
  42.                 </div>
  43.  
  44.                 <button class="btn btn-primary rounded-0 w-100" id="login">Login</button>
  45.  
  46.             </div>
  47.         </div>
  48.  
  49.     </div>
  50.  
  51.     <script>
  52.         $().ready(function() {
  53.             $('button#login').click(function(e) {
  54.                 e.preventDefault();
  55.  
  56.                 var username = $('input#username').val();
  57.                 var password = $('input#password').val();
  58.  
  59.                 if (username !== '' && password !== '') {
  60.                     $('#alert').html('<div class="alert alert-danger my-3">Form tidak boleh kosong!</div>');
  61.                 }
  62.                 else {
  63.  
  64.                     $.ajaxSetup({
  65.                         headers: {
  66.                             'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
  67.                         }
  68.                     })
  69.                     $.ajax({
  70.                         url: '/user/login',
  71.                         type: 'POST',
  72.                         data: {
  73.                             'username': username,
  74.                             'password': password
  75.                         },
  76.                         success: function(res) {
  77.                             if (res.status == 'success') window.location.reload();
  78.  
  79.                             $('#alert').html('<div class="alert "' + res.alertType + ' my-3">' + res.alertText + '</div>');
  80.                         }
  81.                     })
  82.  
  83.                 }
  84.  
  85.             })
  86.         })
  87.     </script>
  88.  
  89. </body>
  90. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement