Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mobildefaultlogin.js 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 MobilLogin extends Unibase.Platform.Core.BaseComponent {
  10. jsFiles() {
  11. var jsfiles = ["tenants/themes/compact/index.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. jQuery(".preloader-it").delay(500).fadeOut("slow");
  22. jQuery("#external-container").delay(500).fadeIn("slow");
  23. jQuery("#bizgaze_body").css("background-color", "#f4f6f7");
  24. $("#InputEmail,#InputPassword").keypress(function (e) {
  25. if (e.which == 13)
  26. document.getElementById("BtnLogin").click();
  27. });
  28. $('#PasswordHide').click(function () {
  29. var input = $('#InputPassword');
  30. input.attr('type') == "password" ? input.attr('type', 'text') : input.attr('type', 'password');
  31. $('#PasswordHide').toggleClass('fa-eye-slash fa-eye');
  32. });
  33. $("#btnClearcache").click(function () {
  34. if (isMobileApp()) {
  35. Unibase.Platform.Helpers.MobileHelper.Instance().openSettings();
  36. }
  37. });
  38. jQuery("#InputEmail,#InputPassword").on("input", function () {
  39. let username = $("#InputEmail").val().toString().trim();
  40. let password = $("#InputPassword").val();
  41. let validData = true;
  42. if (username == '' || username == undefined || password == '' || password == undefined)
  43. validData = false;
  44. if (validData) {
  45. jQuery("#BtnLogin").removeClass("disabled");
  46. }
  47. else {
  48. jQuery("#BtnLogin").addClass("disabled");
  49. }
  50. });
  51. $(".btn-outline-secondary").addClass('hidden');
  52. jQuery("#BtnLogin").click(function () {
  53. instance.validate();
  54. });
  55. if (callback != null) {
  56. callback();
  57. }
  58. }
  59. loadDomainLogo(imagerurl) {
  60. if (imagerurl != null && imagerurl != undefined && imagerurl != "") {
  61. this.imageUrl = imagerurl;
  62. }
  63. else {
  64. this.imageUrl = "tenants/themes/compact/imgs/bg_1.png";
  65. }
  66. }
  67. validate(username, password, remember) {
  68. MessageHelper.Instance().hideMessage();
  69. if (!isMobileApp() || (username == undefined && password == undefined)) {
  70. username = $("#InputEmail").val().toString().trim();
  71. password = $("#InputPassword").val().toString();
  72. remember = $("#InputRemember").prop("checked");
  73. }
  74. else {
  75. remember = true;
  76. }
  77. let validData = true;
  78. if (username == '' || username == undefined || password == '' || password == undefined)
  79. validData = false;
  80. if (validData) {
  81. jQuery("#BtnLogin").addClass("disabled");
  82. jQuery("#BtnLogin").text("Validating");
  83. var request = new Unibase.Platform.Membership.Requests.Login(username, password, '', remember);
  84. if (this._accountManager == undefined) {
  85. this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance();
  86. }
  87. this._accountManager.validateLogin(request).then(function (response) {
  88. var identity = response.result;
  89. if (identity === null) {
  90. if (isMobileApp()) {
  91. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  92. }
  93. MessageHelper.Instance().showError(response.message, 'validation-summary');
  94. jQuery("#BtnLogin").removeClass("disabled");
  95. jQuery("#BtnLogin").text("Login");
  96. }
  97. else {
  98. if (isMobileApp()) {
  99. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials(username, password);
  100. Unibase.Platform.Helpers.MobileHelper.Instance().saveUserDevice(identity.sessionId);
  101. }
  102. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(identity);
  103. window.location.href = '#/welcome';
  104. if (isMobileApp()) {
  105. }
  106. }
  107. });
  108. }
  109. else {
  110. if (isMobileApp()) {
  111. Unibase.Platform.Helpers.MobileHelper.Instance().cacheUserCredantials('', '');
  112. Unibase.Platform.Helpers.MobileHelper.Instance().redirectToLogin();
  113. }
  114. MessageHelper.Instance().showError("Mandatory fields are missing", 'validation-summary');
  115. }
  116. }
  117. html(id, containerid) {
  118. if (jQuery("#external-form").length === 0) {
  119. var index = new Compact.Components.Index_Anonymous();
  120. index.init(null, this.imageUrl);
  121. }
  122. const html = `<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-primary btn-block text-white disabled" id="BtnLogin">Login</a></form><div class="option-sep">or</div><div class="row"><div class="text-center col-sm-12 pa-5"> First time user, <a href="index.html#/registeruser">Click here</a></div><div class="text-center col-sm p-2"></div></div>`;
  123. return html;
  124. }
  125. static Instance() {
  126. return new MobilLogin();
  127. }
  128. }
  129. Components.MobilLogin = MobilLogin;
  130. })(Components = Compact.Components || (Compact.Components = {}));
  131. })(Compact = Themes.Compact || (Themes.Compact = {}));
  132. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  133. })(Unibase || (Unibase = {}));