Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68495 Members, 790 Products, 5357 Topic, 13048 Comments)

Remember me dengan localStorage pada adminLTE

Dibuat
Login Terakhir 22 Hari lalu,
Telah Dilihat 1979 Kali
Munajat Ibnu Mengatakan : Sultan Account
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2.  
  3. <script>
  4. $(function () {
  5. if (localStorage.chkbx && localStorage.chkbx != '') {
  6. $('#remember_me').attr('checked', 'checked');
  7. $('#user_login').val(localStorage.usrname);
  8. $('#password').val(localStorage.pass);
  9. } else {
  10. $('#remember_me').removeAttr('checked');
  11. $('#user_login').val('');
  12. $('#password').val('');
  13. }
  14.  
  15. $('#remember_me').click(function() {
  16.  
  17. if ($('#remember_me').is(':checked')) {
  18. localStorage.usrname = $('#user_login').val();
  19. localStorage.pass = $('#password').val();
  20. localStorage.chkbx = $('#remember_me').val();
  21. } else {
  22. localStorage.usrname = '';
  23. localStorage.pass = '';
  24. localStorage.chkbx = '';
  25. }
  26. });
  27.  
  28. });
  29. </script>
  30.  
  31. Form loginnya
  32.  
  33. <form action="" method="post">
  34. <div class="form-group has-feedback">
  35. <input type="text" class="form-control" id="user_login" name='a' placeholder="Username" required>
  36. <span class="glyphicon glyphicon-user form-control-feedback"></span>
  37. </div>
  38. <div class="form-group has-feedback">
  39. <input type="password" class="form-control" id="password" name='b' placeholder="Password" required>
  40. <span class="glyphicon glyphicon-lock form-control-feedback"></span>
  41. </div>
  42. <div class="row">
  43. <div class="col-xs-8">
  44. <div class="checkbox checkbox-success">
  45. <input id="remember_me" class="styled" type="checkbox">
  46. <label for="remember_me">
  47. Ingatkan saya
  48. </label>
  49. </div>
  50. </div><!-- /.col -->
  51. <div class="col-xs-4">
  52. <button name='login' type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
  53. </div><!-- /.col -->
  54. </div>
  55. </form>
  56. Catatan : tidak bisa berfungsi jika menggunakan jquery iCheck untuk
Ada 1 File Kiriman :
1. Screenshot_2019-09-27_SISFO_Akademik_Log_in.png (10 KB)
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online