Does anyone have a simple example of creating a logon form (where to hook it into WiseJ) and best practices on how it should work to make it secure ?
I looked in the docs and do not see any info at all. Would help to have an example under examples as well. Gizmox used to have a lot of samples/snippets on the basics that really helped out in speeding up putting together an application using VWG.
I did find mention of “Application.Main” in one post that references the Logon Form – but also reading the docs it says that at that point the application has not been created yet so what does this infer ? Does this mean that we need a logon form that is “outside” our application ? Like a plain HTML form ?
We have samples here https://wisej.com/examples but not one for a logon form and not enough – we’ll add many more after the release.
About the login form best practice. VWG worked very differently since the URL was the name of the form to create, therefore you couldn’t control the entry point of your app and needed VWG itself to take care of securing the application and the login.
Wisej instead uses the main html page (or aspx or anything else) as the canvas on which to render its components. (As a side note, this means that you can put all sorts of html in Default.html (or Defaults.aspx) and even interact with Wisej objects.) Wisej has a single entry point that cannot be bypassed in any way, it’s the Main method defined in Default.json. When a session is created the first time, Program.Main() is the first method that is called (if defined in Default.json).
If you don’t create your main windows in Main() then nothing will show in a Wisej app. This lets you handle authentication however it’s best for you app. The easiest approach is to show the login form in Main() and then decide whether to proceed with other windows or not. You can do this at first, or after showing a main window, or later on in the app, or several times depending on permissions, etc.
See the config explanation here : https://docs.wisej.com/docs/concepts/configuration
There is one exception in case you define the mainWindow in Default.json instead of the startup property. In this case you can make the main window your logon form and then create the rest from there.
In Wisej there in no such concept as Login Form. A simple logic could be as follows:
Create a normal Form, e.g. LoginForm, which can contain, let’s say, your login and password textboxes and a Login button. At the login button’s click event execute your login logic and if it is satisfied raise an “Authenicated” event.
In the Program.cs Main method, create and show the LoginForm. Create a handler for the Authenicated event, and in this handler create your application form (after authentication), e.g. AppForm, call the LoginForm’s Hide method and then show the AppForm.
Hope this helps.