first commit
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/AuthController
|
||||
Description : Kontrol Login Session & Auth Supervisi
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 15th, 2008.
|
||||
Last Modified : August 8th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#butLogin').click(LoginJS.Proses_Login);
|
||||
$('#Username').keydown((e) => {
|
||||
if (e.which==13) $('#Password').focus();
|
||||
});
|
||||
$('#Password').keydown((e) => {
|
||||
if (e.which==13) $('#butLogin').trigger('click');
|
||||
});
|
||||
LoginJS.Tampil_Login();
|
||||
$(document).on('contextmenu', (e) => e.preventDefault());
|
||||
|
||||
$.backstretch([
|
||||
[
|
||||
{ width: 1280, url: "assets/images/bs/toko_1280.jpg" },
|
||||
{ width: 960, url: "assets/images/bs/toko_960.jpg" }
|
||||
],
|
||||
[
|
||||
{ width: 1280, url: "assets/images/bs/rak_1280.jpg" },
|
||||
{ width: 960, url: "assets/images/bs/rak_960.jpg" }
|
||||
],
|
||||
[
|
||||
{ width: 1280, url: "assets/images/bs/shop_1280.jpg" },
|
||||
{ width: 960, url: "assets/images/bs/shop_960.jpg" }
|
||||
]
|
||||
], {
|
||||
duration: 6000,
|
||||
transition: 'push_left|push_right|cover_up|cover_down|fade',
|
||||
transitionDuration: 600
|
||||
});
|
||||
});
|
||||
|
||||
var LoginJS = {
|
||||
|
||||
Tampil_Login: function(){
|
||||
var Username = FoniaJS.getCookie('Username');
|
||||
if (Username != '') {
|
||||
$('#Username').val(Username);
|
||||
FoniaJS.setFocus('#Password');
|
||||
} else {
|
||||
FoniaJS.setFocus('#Username');
|
||||
}
|
||||
},
|
||||
|
||||
Proses_Login: function(){
|
||||
if (!$('#Username').val()){
|
||||
$('#Username').focus();
|
||||
FoniaJS.showError('Silahkan masukkan Username !');
|
||||
return false;
|
||||
}
|
||||
if (!$('#Password').val()){
|
||||
$('#Password').focus();
|
||||
FoniaJS.showError('Silahkan masukkan Password !');
|
||||
return false;
|
||||
}
|
||||
new Request({
|
||||
url: 'auth/login',
|
||||
sendParam: ['Username','Password'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
FoniaJS.setCookie('Username', $('#Username').val(), 365);
|
||||
$('#divLoginMsg').html(ajson.message).removeClass('d-none');
|
||||
$('.input-group').addClass('d-none');
|
||||
setTimeout(() => {self.location = ajson.token ?? '';}, 1600);
|
||||
}else{
|
||||
FoniaJS.showInfo(ajson.message, 3000);
|
||||
if (ajson.redir) setTimeout(() => {self.location = ajson.redir;}, 600);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user