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.

mobilnewdefaultlogin.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 MobilNewLogin 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. $('#BtnLogin_nav').click(function () {
  22. $('.first-display').addClass('d-none');
  23. $('.login-display').removeClass('d-none');
  24. });
  25. $('.back-btn').click(function () {
  26. $('.first-display').removeClass('d-none');
  27. $('.login-display').addClass('d-none');
  28. });
  29. jQuery(".preloader-it").delay(500).fadeOut("slow");
  30. jQuery("#external-container").delay(500).fadeIn("slow");
  31. jQuery("#bizgaze_body").css("background-color", "#f4f6f7");
  32. $("#InputEmail,#InputPassword").keypress(function (e) {
  33. if (e.which == 13)
  34. document.getElementById("BtnLogin").click();
  35. });
  36. $('#PasswordHide').click(function () {
  37. var input = $('#InputPassword');
  38. input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
  39. $('#PasswordHide').toggleClass('fa-eye-slash fa-eye');
  40. });
  41. $("#btnClearcache").click(function () {
  42. if (isMobileApp()) {
  43. Unibase.Platform.Helpers.MobileHelper.Instance().openSettings();
  44. }
  45. });
  46. jQuery("#InputEmail,#InputPassword").on("input", function () {
  47. let username = $("#InputEmail").val().toString().trim();
  48. let password = $("#InputPassword").val();
  49. let validData = true;
  50. if (username == '' || username == undefined || password == '' || password == undefined)
  51. validData = false;
  52. if (validData) {
  53. jQuery("#BtnLogin").removeClass("disabled");
  54. }
  55. else {
  56. jQuery("#BtnLogin").addClass("disabled");
  57. }
  58. });
  59. $(".btn-outline-secondary").addClass('hidden');
  60. jQuery("#BtnLogin").click(function () {
  61. instance.validate();
  62. });
  63. if (callback != null) {
  64. callback();
  65. }
  66. }
  67. loadDomainLogo(imagerurl) {
  68. if (imagerurl != null && imagerurl != undefined && imagerurl != "") {
  69. this.imageUrl = imagerurl;
  70. }
  71. else {
  72. this.imageUrl = "tenants/themes/compact/imgs/bg_1.png";
  73. }
  74. }
  75. validate(username, password, remember) {
  76. MessageHelper.Instance().hideMessage();
  77. if (!isMobileApp() || (username == undefined && password == undefined)) {
  78. username = $("#InputEmail").val().toString().trim();
  79. password = $("#InputPassword").val().toString();
  80. remember = $("#InputRemember").prop("checked");
  81. }
  82. else {
  83. remember = true;
  84. }
  85. let validData = true;
  86. if (username == '' || username == undefined || password == '' || password == undefined)
  87. validData = false;
  88. if (validData) {
  89. jQuery("#BtnLogin").addClass("disabled");
  90. jQuery("#BtnLogin").text("Validating");
  91. var request = new Unibase.Platform.Membership.Requests.Login(username, password, '', remember);
  92. if (this._accountManager == undefined) {
  93. this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance();
  94. }
  95. this._accountManager.validateLogin(request).then(function (response) {
  96. var identity = response.result;
  97. if (identity === null) {
  98. if (isMobileApp()) {
  99. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  100. }
  101. MessageHelper.Instance().showError(response.message, 'validation-summary');
  102. jQuery("#BtnLogin").removeClass("disabled");
  103. jQuery("#BtnLogin").text("Login");
  104. }
  105. else {
  106. if (isMobileApp()) {
  107. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials(username, password);
  108. Unibase.Platform.Helpers.MobileHelper.Instance().saveUserDevice(identity.sessionId);
  109. }
  110. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(identity);
  111. window.location.href = '#/welcome';
  112. if (isMobileApp()) {
  113. }
  114. }
  115. });
  116. }
  117. else {
  118. if (isMobileApp()) {
  119. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  120. Unibase.Platform.Helpers.MobileHelper.Instance().redirectToLogin();
  121. }
  122. MessageHelper.Instance().showError("Mandatory fields are missing", 'validation-summary');
  123. }
  124. }
  125. html(id, containerid) {
  126. if (jQuery("#external-form").length === 0) {
  127. var index = new Compact.Components.Index_Mobil_Anonymous();
  128. index.init(null, this.imageUrl);
  129. }
  130. let html = '';
  131. if (($(window).width()) > 1200) {
  132. html += `<div class="row h-100"><div class="col-xl-5"><div class="banner-img-container h-100"><img src="tenants/themes/compact/imgs/mobil-desktop-view-bg.png" alt="img" class="h-100 w-100 "> </div></div><div class="col-xl-7 desktop-view"><form id="Frm_Login" default="" data-validate="parsley" data-isdynamic="false"><h1 class="display-4 mb-10">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">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 col-sm-12 pa-5">Don't have an account? <a href="index.html#/registeruser">Register</a></div></div></div></div>`;
  133. }
  134. else {
  135. html = `<div class="">
  136. <form id="Frm_navgator" default="" class="p-4 first-display" data - validate="parsley" data - isdynamic="false" >
  137. <div class="d-flex flex-column h-100 justify-content-around p-3">
  138. <div class="logo_img mx-auto "> <img src="tenants/themes/compact/imgs/mobil-logo.png" class="img-fluid w-60">
  139. <h5 class="text-white font-weight-bold"> Connect </h5>
  140. </div>
  141. <div>
  142. <div class="footer-login ">
  143. <div class="mb-25"> <a class="btn btn-block rounded-10 text-white w-70 mx-auto shadow-lg-blue" style="background:#001F5D ;padding: 10px !important;" id="BtnLogin_nav"> Login </a></div>
  144. <div class="mb-25 "> <a class="btn btn-block rounded-10 border w-70 mx-auto bg-white text-dark" href="${_appsettings.server_url()}/index.html#/registeruser" style="padding: 10px !important;" id="RegisterLogin"> Register </a></div>
  145. <div></div>
  146. </div>
  147. </div>
  148. </div>
  149. </form>
  150. </div>
  151. <div class="">
  152. <form id="Frm_Login" default="" class="p-4 d-none login-display" data - validate="parsley" data - isdynamic="false" >
  153. <div class=" text-left">
  154. <a class="text-secondary mr-auto mt-25p back-btn"> <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="#ffff" class="bi bi-arrow-left" viewBox="0 0 16 16"> <path fill - rule="evenodd" d = "M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" /> </svg></a>
  155. </div>
  156. <div id="validation-summary" class="position-fixed w-85"> </div>
  157. <div class="d-flex flex-column h-100 justify-content-around p-3">
  158. <div class="logo_img mx-auto"> <img src="tenants/themes/compact/imgs/mobil-logo.png" class="img-fluid w-40">
  159. <h5 class="text-white font-weight- bold"> Connect </h5>
  160. </div>
  161. <div>
  162. <div class="form-group"> <input class="form-control login-input bg-white" id="InputEmail" placeholder="Phone or Email" type="text"></div>
  163. <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>
  164. <div class="input-group mb-20">
  165. <div class="col-xs mx-auto">
  166. <p class="text-center ">
  167. <a class="text-white" href="${_appsettings.server_url()} /index.html#/forgotpassword"> <small class="font-11"> Forgot Password ? </small></a>
  168. </p>
  169. </div>
  170. </div>
  171. </div>
  172. <div class="footer-login">
  173. <div class="mb-25"> <a class="btn btn-block rounded-10 text-white w-70 mx-auto shadow-lg-blue" style="background:#001F5D; padding: 10px!important;" id="BtnLogin"> Login </a></div>
  174. </div>
  175. </div>
  176. </form>
  177. </div>`;
  178. }
  179. return html;
  180. }
  181. static Instance() {
  182. return new MobilNewLogin();
  183. }
  184. }
  185. Components.MobilNewLogin = MobilNewLogin;
  186. })(Components = Compact.Components || (Compact.Components = {}));
  187. })(Compact = Themes.Compact || (Themes.Compact = {}));
  188. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  189. })(Unibase || (Unibase = {}));