Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('sys_run_app') OR exit('403 You dont have permission to access / on this server...'); ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Example Login | Tutorial Garuda Framework Pro</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <?= _importJQuery(); ?>
- <?= _importBootstrap(); ?>
- <?= _importGF(); ?>
- <?= _importSweetAlert(); ?>
- <body>
- <div class="container">
- <hr>
- <center><h2>Login </h2></center>
- <hr>
- <div class="well well-sm">
- <center><a href="./forgot">FORGOT PASSWORD</a></center>
- </div>
- </div>
- <div class="container">
- <div class="jumbotron">
- <div id="my_alert"></div>
- <input type="text" id="txt_email" class="form-control" name="" placeholder="Email..." required="">
- </br>
- <input type="password" id="txt_pass" class="form-control" name="" placeholder="New Password..." required="">
- </br>
- <input type="checkbox" name="" value="" id="my_check" > I Am Not Robot
- <hr>
- <button id="btn_login" class="btn btn-primary">LOGIN</button>
- </div>
- </div>
- <script type="text/javascript">
- $(document).ready(function(){
- _focus("txt_email");
- _onClick("btn_login",function(){
- login();
- });
- function login()
- {
- let email = _getValById("txt_email");
- let pass = _getValById("txt_pass");
- let my_check = _getById("my_check");
- const token = _randomStr(5);
- if (email==='')
- {
- _writeAlert("my_alert","Upzz you have to type the email !","warning");
- _focus("txt_email");
- return;
- }
- if (_checkEmail(email))
- {
- if (pass==='')
- {
- _focus("txt_pass");
- _writeAlert("my_alert","Upzz you have to type the new password !","warning");
- return;
- }
- if (my_check.checked==false)
- {
- _writeAlert("my_alert","Please Confirm You Are Not Robot","danger");
- return;
- }
- _printTo("my_alert","");
- btn_login.disabled=true;
- // Ini ajax dengan POST Garuda Javascript
- _requestPOST("./process-login","token="+token
- +"&email="+email
- +"&pass="+pass+"",function(res){
- if (res)
- {
- const obj = JSON.parse(res);
- if (obj)
- {
- let result = obj.result;
- if (result==='F')
- {
- swal("Upzz !","Email or Password is wrong !","error");
- _focus("txt_email");
- }
- else if (result==='T')
- {
- _refresh(_myUrl()+"welcome");
- }
- }
- }
- btn_login.disabled=false;
- my_check.checked =false;
- });
- }
- else
- {
- _writeAlert("my_alert","Upzz your email is not valid !","danger");
- _focus("txt_email");
- return;
- }
- }
- // ini untuk custom keyboard saat menekan tombol INSERT
- _keyCustom(function(){
- login();
- },_keyCode.insert);
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment