Purpose: This document describes properties available within the Login class.
Login Class Properties
The Login class contains two shared (static) properties that can be used to control settings pertaining to the logging of users into your application.
- LoginFormType
- LoginSecurityKey
LoginFormType
The LoginFormType property gets or sets a System.Type object that represents the form type of the login form that will be presented to the end-user to gather the user's credentials. The default value for this property is MicroFour.StrataFrame.Security.LoginForm which is the included login form. If you create a custom login form for your application you will need to set this property to your custom login form type before the first call to a StrataFrame security method that will show a login form.
Private Shared Sub ShowLoginAndInitMainForm(ByVal e As ShowLoginAndInitFormEventArgs) '-- Set the login form to your custom login form (optional) Login.LoginFormType = GetType(MyCustomLoginForm) '-- Show the login form and authenticate the user e.ShowMainForm = Login.ShowLoginAndAuthUser(True) End Sub
private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)
{
//-- Set the login form to your custom login form (optional)
Login.LoginFormType = typeof(MyCustomLoginForm);
//-- Show the login form and authenticate the user
e.ShowMainForm = Login.ShowLoginAndAuthUser(true);
}LoginSecurityKey
The LoginSecurityKey property gets or sets the key of the permission that is required for users to be allowed to login to the application. The default value for this property is an empty string ("") which ensures that it will always be Granted to the CurrentUser object.
It is not recommended to globally control whether a user can log into the application (you should deactivate a user to completely prevent them from logging in) but is meant to be used in conjunction with a restriction set to limit where (workstation) and when (hours of operation) the user can log into the application. To use this property, you must create a permission within the application's permissions and specify the name when setting this property.
Private Shared Sub ShowLoginAndInitMainForm(ByVal e As ShowLoginAndInitFormEventArgs) '-- Set the permission required to login to the application Login.LoginSecurityKey = "MyLoginKey" '-- Set the login form to your custom login form (optional) Login.LoginFormType = GetType(MyCustomLoginForm) '-- Show the login form and authenticate the user e.ShowMainForm = Login.ShowLoginAndAuthUser(True) End Sub
private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)
{
//-- Set the permission required to login to the application
Login.LoginSecurityKey = "MyLoginKey";
//-- Set the login form to your custom login form (optional)
Login.LoginFormType = typeof(MyCustomLoginForm);
//-- Show the login form and authenticate the user
e.ShowMainForm = Login.ShowLoginAndAuthUser(true);
}