| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let InviteUsers;
- (function (InviteUsers) {
- let Components;
- (function (Components) {
- class UserLogin extends Platform.Core.BaseComponent {
- cssFiles() {
- return [];
- }
- jsFiles() {
- return ["platform/inviteusers/components/userlogin.js", "platform/inviteusers/managers/inviteusermanager.js", "platform/membership/managers/accountmanager.js"];
- }
- html(id, containerid) {
- let html = `<div class="col-lg-12-removed"><div class="Border"><div id="" class="card portletwidget-item">
- <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>`;
- return html;
- }
- load(id, containerid, callback) {
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var IsUser = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_loginenabled").Value;
- var Stagename = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_stagename").Value;
- if (IsUser == false) {
- $("#btnUserLogin").hide();
- $("#userMsg").show().text("User not registered");
- }
- else if (Stagename == "Relieved") {
- $("#btnUserLogin").hide();
- $("#userMsg").show().text("User Relieved");
- }
- else {
- var userIdentity = Unibase.Platform.Helpers.CookieHelper.Instance().getUserIdentityCookie();
- if (userIdentity == "") {
- $("#btnUserLogin").show();
- $("#userMsg").hide();
- }
- else {
- $("#btnUserLogin").hide();
- $("#userMsg").show().text("You are already in the child user log in.Please log out from the current user to use this option.");
- }
- }
- }
- init(containerid) {
- var instance = this;
- instance.fileCacheHelper.loadJsFiles(["platform/inviteusers/components/userlogin.js", "platform/inviteusers/managers/inviteusermanager.js"], null);
- instance.navigationHelper.loadSection(0, containerid, Unibase.Platform.InviteUsers.Components.UserLogin.Instance(), null, null);
- }
- userLogin() {
- var unibaseid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_unibaseid").Value;
- Unibase.Platform.Membership.Managers.AccountManager.Instance().userLogin(unibaseid).then(function (response) {
- if (response === undefined) {
- alert("Login Failed");
- }
- else {
- var parentUserId = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId;
- var identity = response.result;
- identity.parentUserId = parentUserId;
- var cookieHelper = Unibase.Platform.Helpers.CookieHelper.Instance();
- var str = JSON.stringify(Unibase.Platform.Membership.Infos.Identity.getCurrentUser());
- cookieHelper.setUserIdentityCookie(str);
- Unibase.Platform.Membership.Infos.Identity.setCurrentUser(identity);
- window.location.href = '#/welcome';
- window.location.reload();
- MessageHelper.Instance().showSuccess(response.message, '');
- }
- });
- }
- static Instance() {
- return new UserLogin();
- }
- }
- Components.UserLogin = UserLogin;
- })(Components = InviteUsers.Components || (InviteUsers.Components = {}));
- })(InviteUsers = Platform.InviteUsers || (Platform.InviteUsers = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
|