Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

homeaffairsdefaultlogin.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. var Unibase;
  2. (function (Unibase) {
  3. let Themes;
  4. (function (Themes) {
  5. let Compact;
  6. (function (Compact) {
  7. let Components;
  8. (function (Components) {
  9. class HomeAffairsLogin extends Unibase.Platform.Core.BaseComponent {
  10. jsFiles() {
  11. var jsfiles = ["tenants/themes/compact/index.mobil_anonymous.js", "platform/membership/managers/accountmanager.js", "platform/membership/infos/identity.js", "platform/membership/requests/login.js", "platform/core/helpers/cookies/cookiehelper.js", "tenants/themes/compact/components/notifications/notification.js", "platform/core/enums/rowstatus.js"];
  12. return jsfiles;
  13. }
  14. cssFiles() {
  15. return [];
  16. }
  17. load(id, containerid, callback) {
  18. this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance();
  19. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(null);
  20. var instance = this;
  21. $(".biz-pg-wrapper").addClass("mt-0");
  22. $('#BtnLogin_nav').click(function () {
  23. $('.first-display').addClass('d-none');
  24. $('.login-display').removeClass('d-none');
  25. });
  26. $('.back-btn').click(function () {
  27. $('.first-display').removeClass('d-none');
  28. $('.login-display').addClass('d-none');
  29. });
  30. if (isMobileApp()) {
  31. $('#Frm_Login').find('.register-div').addClass('d-none');
  32. }
  33. jQuery(".preloader-it").delay(500).fadeOut("slow");
  34. jQuery("#external-container").delay(500).fadeIn("slow");
  35. jQuery("#bizgaze_body").css("background-color", "#f4f6f7");
  36. $("#InputEmail,#InputPassword").keypress(function (e) {
  37. if (e.which == 13)
  38. document.getElementById("BtnLogin").click();
  39. });
  40. $('#PasswordHide').click(function () {
  41. var input = $('#InputPassword');
  42. input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
  43. $('#PasswordHide').toggleClass('fa-eye-slash fa-eye');
  44. });
  45. $("#btnClearcache").click(function () {
  46. if (isMobileApp()) {
  47. Unibase.Platform.Helpers.MobileHelper.Instance().openSettings();
  48. }
  49. });
  50. jQuery("#InputEmail,#InputPassword").on("input", function () {
  51. let username = $("#InputEmail").val().toString().trim();
  52. let password = $("#InputPassword").val();
  53. let validData = true;
  54. if (username == '' || username == undefined || password == '' || password == undefined)
  55. validData = false;
  56. if (validData) {
  57. jQuery("#BtnLogin").removeClass("disabled");
  58. }
  59. else {
  60. jQuery("#BtnLogin").addClass("disabled");
  61. }
  62. });
  63. $(".btn-outline-secondary").addClass('hidden');
  64. jQuery("#BtnLogin").click(function () {
  65. instance.validate();
  66. });
  67. if (callback != null) {
  68. callback();
  69. }
  70. }
  71. loadDomainLogo(imagerurl) {
  72. if (imagerurl != null && imagerurl != undefined && imagerurl != "") {
  73. this.imageUrl = imagerurl;
  74. }
  75. else {
  76. this.imageUrl = "tenants/themes/compact/imgs/bg_1.png";
  77. }
  78. }
  79. validate(username, password, remember) {
  80. MessageHelper.Instance().hideMessage();
  81. if (!isMobileApp() || (username == undefined && password == undefined)) {
  82. username = $("#InputEmail").val().toString().trim();
  83. password = $("#InputPassword").val().toString();
  84. remember = $("#InputRemember").prop("checked");
  85. }
  86. else {
  87. remember = true;
  88. }
  89. let validData = true;
  90. if (username == '' || username == undefined || password == '' || password == undefined)
  91. validData = false;
  92. if (validData) {
  93. jQuery("#BtnLogin").addClass("disabled");
  94. jQuery("#BtnLogin").text("Validating");
  95. var request = new Unibase.Platform.Membership.Requests.Login(username, password, '', remember);
  96. if (this._accountManager == undefined) {
  97. this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance();
  98. }
  99. this._accountManager.validateLogin(request).then(function (response) {
  100. var identity = response.result;
  101. if (identity === null) {
  102. if (isMobileApp()) {
  103. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  104. }
  105. MessageHelper.Instance().showError(response.message, 'validation-summary');
  106. jQuery("#BtnLogin").removeClass("disabled");
  107. jQuery("#BtnLogin").text("Login");
  108. }
  109. else {
  110. if (isMobileApp()) {
  111. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials(username, password);
  112. Unibase.Platform.Helpers.MobileHelper.Instance().saveUserDevice(identity.sessionId);
  113. }
  114. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(identity);
  115. window.location.href = '#/welcome';
  116. if (isMobileApp()) {
  117. }
  118. }
  119. });
  120. }
  121. else {
  122. if (isMobileApp()) {
  123. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  124. Unibase.Platform.Helpers.MobileHelper.Instance().redirectToLogin();
  125. }
  126. MessageHelper.Instance().showError("Mandatory fields are missing", 'validation-summary');
  127. }
  128. }
  129. html(id, containerid) {
  130. if (jQuery("#external-form").length === 0) {
  131. var index = new Compact.Components.Index_Mobil_Anonymous();
  132. index.init(null, this.imageUrl);
  133. }
  134. let assesturl = _appsettings.asset_url();
  135. let html = '';
  136. if (($(window).width()) > 1200) {
  137. html += `<div class="row h-100" style="background:url('` + assesturl + `tenants/themes/compact/imgs/homeaffairs/homeaffariesdesktopbg.jpg');background-size:cover;"><div class="col-xl-5"><div class="banner-img-container h-100 d-flex align-items-center justify-content-center pl-145"><img src="` + assesturl + `tenants/themes/compact/imgs/homeaffairs/aa.png" alt="img" class="img-fluid"> </div></div><div class="col-xl-7 desktop-view d-flex align-items-center justify-content-center flex-column pr-140 text-white"><form id="Frm_Login" default="" data-validate="parsley" data-isdynamic="false"><h1 class="display-4 mb-10 text-white">Login</h1><p class="mb-30">Sign in to your account and enjoy unlimited perks.</p><div id="validation-summary"></div><div class="form-group"><input class="form-control" id="InputEmail" placeholder="Phone or Email" type="text"></div><div class="form-group mb-20"><input class="form-control" id="InputPassword" placeholder="Password" type="password" autocomplete="new-password"><span toggle="#InputPassword" id="PasswordHide" class="fa fa-eye-slash font-15 mr-10 field-icon"></span></div><div class="input-group mb-20"><div class="custom-control custom-checkbox col-xs"><input class="custom-control-input" id="InputRemember" type="checkbox"><label class="custom-control-label font-14" for="InputRemember">Keep me logged in</label></div><div class="col-xs ml-auto"><p class="text-right"><a href="index.html#/forgotpassword" class="text-white">Forgot Password?</a></p></div></div><a class="btn btn-block text-white disabled" id="BtnLogin" style="background:#001F5D;">Login</a></form><div class="option-sep">or</div><div class="row"><div class="text-center pa-5">Already an existing user? <a href="index.html#/registeruser">Register</a></div><div class="text-center col-sm p-2"></div></div></div></div>`;
  138. }
  139. else {
  140. html = `<form id="Frm_Login" default="" class="p-4 login-display d-flex biz-custom-scrollbar" data - validate="parsley" data - isdynamic="false" style="background:url('` + assesturl + `tenants/themes/compact/imgs/homeaffairs/homeaffariesmobilebg.jpg')!important;background-size:cover;">
  141. <div id="validation-summary" class="position-fixed w-85"> </div>
  142. <div class="d-flex flex-column justify-content-between p-3">
  143. <div class="logo_img mx-auto"> <img src="tenants/themes/compact/imgs/homeaffairs/aa.png" class="img-fluid w-100">
  144. </div>
  145. <div>
  146. <div class="form-group"> <input class="form-control login-input bg-white" id="InputEmail" placeholder="Phone or Email" type="text"></div>
  147. <div class="form-group mb-20"> <input class="form-control login-input" id="InputPassword" placeholder="Password" type="password" autocomplete="new- password"> <span toggle="#InputPassword" id="PasswordHide" class="fa fa-eye-slash font-15 mr-10 field-icon"></span> </div>
  148. <div class="input-group mb-20"><div class="custom-control custom-checkbox col-xs"><input class="custom-control-input" id="InputRemember" type="checkbox"><label class="custom-control-label font-14 text-charcoal-dark-3" for="InputRemember">Keep me logged in</label></div><div class="col-xs ml-auto"><p class="text-right"><a href="index.html#/forgotpassword" class="text-white">Forgot Password?</a></p></div></div>
  149. <div class="input-group mb-20 flex-column">
  150. <a class="btn btn-block rounded-10 text-white w-70 mt-25 mx-auto shadow-lg-blue" style="background:#001F5D; padding: 10px!important;" id="BtnLogin"> Login </a>
  151. </div>
  152. <div class="register-div">
  153. <div class="option-sep">or</div>
  154. <div class="row"><div class="text-center text-brown col-sm-6 pa-5 text-dark">Already an existing user? <a href="index.html#/registeruser" class="text-white">Register</a></div><div class="text-center col-sm p-2"></div></div>
  155. </div>
  156. </div>
  157. </div>
  158. </form>
  159. </div>`;
  160. }
  161. return html;
  162. }
  163. static Instance() {
  164. return new HomeAffairsLogin();
  165. }
  166. }
  167. Components.HomeAffairsLogin = HomeAffairsLogin;
  168. })(Components = Compact.Components || (Compact.Components = {}));
  169. })(Compact = Themes.Compact || (Themes.Compact = {}));
  170. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  171. })(Unibase || (Unibase = {}));