Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: Determine user domain name? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
MWPollard
Newbie
Newbie


Joined: 30 December 2013
Location: United States
Online Status: Offline
Posts: 2
Posted: 30 December 2013 at 11:24pm | IP Logged Quote MWPollard

Is there a way to programmatically (without manually creating a parsing routine) determine the user's domain name? I am using WebMail Lite PHP 7.1.1.1.

I have multiple domains that use the same email server addresses, but separate (domain-specific) websites for advanced settings - that's how the hosting service (DreamHost.com) handles them. This makes basic webmail easy, with a single webmail page for all domains, but now I need to create links for the Email Accounts Settings pane that goes to the correct advanced settings page for the user's domain.

I am opening the offsite page from \static\js\app.js:
CEmailAccountsSettingsViewModel.prototype.executeOpenAdvancedSettings = function ()
{
     var sUrl = "https://mailboxes." + "<DOMAIN-NAME>.com";
     Utils.WindowOpener.openTab(sUrl);
};

This works, just hard-coded to the domain name. Obviously I have already split the sides of the URL to simplify the change, and removed my actual domain name.


For what it's worth and for the benefit of others, I have already added the link on the Email Accounts Settings pane, using these changes:

In \i18n\English.ini:
ACCOUNTS_ADVANCED_SETTINGS = "Advanced Settings"
ACCOUNTS_ADVANCED_SETTINGS_HINT1 = "At this page, you can change your password, create filters, create an autoresponder, and more."
ACCOUNTS_ADVANCED_SETTINGS_HINT2 = "Please Note: Since the advanced settings are on a different server, you will need to re-enter your login information to access this page. For this reason, this page may also give you a security warning. Please allow the page to continue - all your information is encrypted and protected."

In \templates\views\Settings\AccountPropertiesViewModel.html:
<div class="row">
     <span class="link" data-i18n="SETTINGS/ACCOUNTS_ADVANCED_SETTINGS" data-bind="i18n: 'text', click: function () { $parent.executeOpenAdvancedSettings() }">
     </span>
</div>
<div class="hint">
     <span data-i18n="SETTINGS/ACCOUNTS_ADVANCED_SETTINGS_HINT1" data-bind="i18n: 'text'">
     </span>
</div>
<div class="hint">
     <span data-i18n="SETTINGS/ACCOUNTS_ADVANCED_SETTINGS_HINT2" data-bind="i18n: 'text'">
     </span>
</div>

For simplicity, I turned off language options in settings.xml (<AllowLanguageOnLogin>Off), but if I wanted the flexibility, I could have added translations to all the other language files. I also turned <AllowUsersChangeEmailSettings>Off since it doesn't work without an AfterLogic backend, and <LoginSignMeType>Unuse since it would take more work to function. I wanted to hide features from my users that don't (currently) work.

The above code is working, but it only works for one hard-coded domain.
Back to Top View MWPollard's Profile Search for other posts by MWPollard
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 03 January 2014 at 2:19am | IP Logged Quote Igor

I will check this with the developers and request an insight from them. They're currently off for holidays till 9th Jan so it will take a while

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
MWPollard
Newbie
Newbie


Joined: 30 December 2013
Location: United States
Online Status: Offline
Posts: 2
Posted: 04 January 2014 at 6:56pm | IP Logged Quote MWPollard

I appreciate your response and your help.

I think I will use an alternate method for now (an interstitial page that asks for the domain name, since I have already alerted the user they will need to log in again), but I would like to improve it when the developers can give feedback, and the theme will come up again later.

When they can do so, full documentation on all the methods, functions, and constants/variables for this new version would be helpful. Much of the documentation is for the old version, which didn't have the flexibility we have now - once we know how to use it.
Back to Top View MWPollard's Profile Search for other posts by MWPollard
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 07 January 2014 at 12:56pm | IP Logged Quote Igor

Actually, we've recently published new developer documentation for current WebMail version, you can find it on main documentation page of the product, specifically see "Integration and Customization" section.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 09 January 2014 at 5:26am | IP Logged Quote Igor

Developers suggest the following code for getting user's domain name:

Code:
var
  oAccount = AppData.Accounts.getCurrent(),
  sEmail = oAccount.email(),
  iPos = sEmail.indexOf('@'),
  sDomain = sEmail.substring(iPos + 1)
;


Hope this helps!

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide