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.

userlogin.js 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var Unibase;
  2. (function (Unibase) {
  3. let Platform;
  4. (function (Platform) {
  5. let InviteUsers;
  6. (function (InviteUsers) {
  7. let Components;
  8. (function (Components) {
  9. class UserLogin extends Platform.Core.BaseComponent {
  10. cssFiles() {
  11. return [];
  12. }
  13. jsFiles() {
  14. return ["platform/inviteusers/components/userlogin.js", "platform/inviteusers/managers/inviteusermanager.js", "platform/membership/managers/accountmanager.js"];
  15. }
  16. html(id, containerid) {
  17. let html = `<div class="col-lg-12-removed"><div class="Border"><div id="" class="card portletwidget-item">
  18. <div class="card-header card-header-action"><span id="hf-widget-title" class="biz-highlight-bg-color">User Login</span></div><div class="card-body"><div class="col-sm-12 text-center" id="UserLoginDiv"><strong id="userMsg"></strong><a style="display:none" href="javascript:;" id="btnUserLogin" onclick="Unibase.Platform.InviteUsers.Components.UserLogin.Instance().userLogin();" class="clear btn btn-outline-success">User Login</a></div></div></div></div>`;
  19. return html;
  20. }
  21. load(id, containerid, callback) {
  22. var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  23. var IsUser = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_loginenabled").Value;
  24. var Stagename = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_stagename").Value;
  25. if (IsUser == false) {
  26. $("#btnUserLogin").hide();
  27. $("#userMsg").show().text("User not registered");
  28. }
  29. else if (Stagename == "Relieved") {
  30. $("#btnUserLogin").hide();
  31. $("#userMsg").show().text("User Relieved");
  32. }
  33. else {
  34. var userIdentity = Unibase.Platform.Helpers.CookieHelper.Instance().getUserIdentityCookie();
  35. if (userIdentity == "") {
  36. $("#btnUserLogin").show();
  37. $("#userMsg").hide();
  38. }
  39. else {
  40. $("#btnUserLogin").hide();
  41. $("#userMsg").show().text("You are already in the child user log in.Please log out from the current user to use this option.");
  42. }
  43. }
  44. }
  45. init(containerid) {
  46. var instance = this;
  47. instance.fileCacheHelper.loadJsFiles(["platform/inviteusers/components/userlogin.js", "platform/inviteusers/managers/inviteusermanager.js"], null);
  48. instance.navigationHelper.loadSection(0, containerid, Unibase.Platform.InviteUsers.Components.UserLogin.Instance(), null, null);
  49. }
  50. userLogin() {
  51. var unibaseid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_unibaseid").Value;
  52. Unibase.Platform.Membership.Managers.AccountManager.Instance().userLogin(unibaseid).then(function (response) {
  53. if (response === undefined) {
  54. alert("Login Failed");
  55. }
  56. else {
  57. var parentUserId = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId;
  58. var identity = response.result;
  59. identity.parentUserId = parentUserId;
  60. var cookieHelper = Unibase.Platform.Helpers.CookieHelper.Instance();
  61. var str = JSON.stringify(Unibase.Platform.Membership.Infos.Identity.getCurrentUser());
  62. cookieHelper.setUserIdentityCookie(str);
  63. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(identity);
  64. window.location.href = '#/welcome';
  65. window.location.reload();
  66. MessageHelper.Instance().showSuccess(response.message, '');
  67. }
  68. });
  69. }
  70. static Instance() {
  71. return new UserLogin();
  72. }
  73. }
  74. Components.UserLogin = UserLogin;
  75. })(Components = InviteUsers.Components || (InviteUsers.Components = {}));
  76. })(InviteUsers = Platform.InviteUsers || (Platform.InviteUsers = {}));
  77. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  78. })(Unibase || (Unibase = {}));