Login - Log in to a MACRO database LoginSecurity - Log in to a security database |
These routines enable a named user to log in to a specific MACRO database
(and optionally a specific security database) with a password and user
role. The login may or may not be successful depending on the existence
of the user, the correctness of the password, password expiry settings
etc.
If the login is successful, a MACRO 4 user object is created, which must be passed as a parameter to all subsequent routines.
A user object will not be returned if login fails due to an invalid user name or password, an invalid role or the user account being locked or disabled.
A user object will be returned if the password has expired or is about to expire. However, if the password has already expired, for security reasons the user should not be allowed to continue until they have successfully changed their password.
If a new user tries to log in before having reset their temporary password, they will be prompted to change it. Currently this initial password change for a new user can only be done by logging into a MACRO module. Subsequent password changes can be done via the API.
Login |
Log in to MACRO.
Input
Parameter |
Description |
userName |
Your user name |
password |
Your password |
databaseCode |
The name of the database you wish to log in to |
userRole |
Your user role |
webServer |
True if using ASP.NET, otherwise, False |
public static LoginResult Login(string userName, string password,string databaseCode, string userRole, bool webServer, ref string message, ref string userNameFull, ref UserProperties user) |
Output
· Return code indicating success or nature of failure
· message - if login fails, an error message string describes the reason for failure (e.g. non-existent user, password expired, etc.)
· userNameFull - if login succeeds, the full name of the user is returned
· user - if login succeeds, the relevant MACRO user object to be used in subsequent calls is returned
LoginSecurity |
Log in to MACRO specifying a security database.
Input
Parameter |
Description |
userName |
Your user name |
password |
Your password |
databaseCode |
The name of the data database to log into (may be the same as the security database) |
userRole |
Your user role |
securityCon |
The database connection string for the security database you wish to use |
public static LoginResult LoginSecurity(string userName, string password, string databaseCode, string userRole, string securityCon, ref string message, ref string UserNameFull, ref UserProperties user) |
Output
· Return code indicating success or nature of failure (see below)
· message - if login fails, an error message string describes the reason for failure (e.g. invalid security database, non-existent user, password expired, etc.)
· userNameFull - if login succeeds, the full name of the user is returned
· user - if login succeeds, the relevant MACRO user object to be used in subsequent calls is returned
The login routines return an integer code of type LoginResult indicating the overall result, as listed in the table below.
A valid user object will only be returned for result codes 0, 4 and 5. However, for a result code of 5 (password expired), the user should not be allowed to continue until the password has been changed.
Code |
Value |
Description |
0 |
Success |
The operation was successful |
1 |
AccountDisabled |
The user has been disabled |
2 |
IncorrectPassword |
User password was incorrect |
3 |
UnknownUserId |
User name was incorrect |
4 |
ChangePassword |
User password is within 7 days of expiry |
5 |
PasswordExpired |
User password has expired |
6 |
InvalidSecurityDB |
The security database connection string is not valid |
7 |
IncorrectRole |
User role was incorrect |
8 |
Fail |
Unexplained fail, check associated message for reason |
9 |
ResetPassword |
The user's password has been reset and needs to be changed by the user |
10 |
LockedOut |
The user has been locked out due to too many incorrect password attempts |