iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi Guys,
Aside from User Authentication process... how do we add a step before the login process? Say we need to add a step before the user login with a username and a password. Keeping in mind that we disabled social services since the app was designed for specific clients and unavailable for public use. Now, this additional pre-login process should capture a company code that will be used to generate the URL for the enterprise Web API, and should be saved the same way as the user's cached session data. How do we implement this scenario, in such a way the we need to EnsureActivation in order to specify a valid URL to the AppSettings.WebServerUrl before a user can login and use the app?
This scenario is needed due to multiple clients, which can serve their own data and/or web service. And for the same reason, a company code is needed to identify the database connection string.
Please advise. Thanks!
Hello Jimmy,
In your scenario, do you need to talk with the server before the login? If not, then presumably you can generate the web server URL based on the company code in the client.
If that's the case, I'd suggest you to add a text field in the same login form, i.e., above the user name field. This avoids unnecessary complexity and also provides a good experience for your users. I'd imagine that you can capture the company code in the LoginViewModel and then generate the web server URL respectively. You can then easily override the appSetting's WebServerUrl in the method by resolving the instance of the setting through the following code:
var settings = Container.Current.Resolve<AppSettings>;settings.WebServerUrl = GenerateServerUrl(companyCode);
Once the desired properties are set to the app settings, the subsequent call to the service will honor the new values.
Hope this helps!
if (!this.ActivationService.IsActivated()){ // Inside this viewmodel, a company code will be accepted from user's input. // The company code will be validated. Once confirmed valid, the details to // construct the Url for Crosslight's services will be retrieved and stored // to the device for future reference. Then, the Url will be generated and // assigned to the WebServerUrl and BaseAppUrl respectively. Afterwhich, the // user will be redirected to the LoginView via HomeViewModel. this.SetRootViewModel<ActivationViewModel>();}else{ // Initialize the AppSettings here. var appSettings = Container.Current.Resolve<AppSettings>; appSettings.WebServerUrl = this.ActivationService.GetStoredWebUrl(); appSettings.BaseAppUrl = appSettings.WebServerUrl + this.ActivationService.GetStoredAppName(); appSettings.BaseImageUrl = appSettings.BaseAppUrl + "/images/"; appSettings.RestServiceUrl = appSettings.BaseAppUrl + "/data/Inventory"; appSettings.IdentityServiceUrl = appSettings.BaseAppUrl + "/data/Identity"; appSettings.PushNotificationServiceUrl = appSettings.BaseAppUrl + "/data/PushNotification"; // Initialize the account service this.AccountService.Initialize(typeof(LoginViewModel)); // Set the root ViewModel to be displayed at startup if (!this.AccountService.IsLoggedIn()) { // Not logged-in, redirect user to the home page this.SetRootViewModel<HomeViewModel>(); } else { // Redirect user to main UI this.SetRootViewModel<DrawerViewModel>(); } // Push notification registration. this.RegisterDeviceForPushNotification(); }
Looking at your code, it supposed to work correctly. I also presume that you already have the appSettings registered in the constructor (which set other settings). As long as the appSettings was previously registered, you will then be able to resolve it at any point of your application, including OnStart method. The changes you made to the appSettings in the OnStart will persist automatically (as it's instance member assignment).
If you still encounter issue, feel free to post the error details so we can help to investigate what could be missing.
Hope this helps.
Please find my simple sample which I uploaded to OneDrive. The sample is created using business project template. I modified LoginViewModel.cs and IdentityController.cs file where I add method (GenerateServerUrl) and override AppSettings's WebServerUrl.
Feel free to let me know whether it helps or not.
...verify the download link, the files is no longer available...
I have fixed the link and ensure that the link works now. Please retry to download the sample and let us hear your response.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname