StrataFrame Forum

Login.LoginResult

http://forum.strataframe.net/Topic5721.aspx

By Tim Dol - 1/10/2007

I need to execute some initialization code in the AppMain to check if the user has exceeded licensed user count , but only if the user successfully logs in, so in the AppMain, just after e.ShowMainForm = Login.ShowLoginAndAuthUser(True), I want to test to see if the login was successful.  I see there is an enum type for Login.LoginResult, however I can seem to test this value and get the desired results.

if Login.LoginResult.Success Then

'Do initialization Stuff...

End If

Any idea's?  Also, is this the best place to add this type of initialization code?

By Ivan George Borges - 1/10/2007

Hi Tim.

Hope everything is fine with you.

In the help file, under "Showing the Initial Login Form", it states:

"Once the LoginFormType has been set (or left to the default value), you can call the Login.ShowLoginAndAuthUser() method to show the login form and authenticate a user into the system. The method will return a Boolean value indicating whether the end-user was authenticated or he/she canceled out of the form and the application should exit."

Does this answer it?

Hope it helped.


 

By Greg McGuffey - 1/10/2007

e.ShowMainForm = Login.ShowLoginAndAuthUser(True)




I'm pretty sure that either they login successfully with this line or they must exit the app. I.e. the return of the Login.ShowLoginAndAuthUser returns true if success, false otherwise. This result is passed to the e.ShowMainForm, which if it is passed false, closes the app.



So, if you want to do some initialization stuff.....





Dim success as boolean = Login.ShowLoginAndAuthUser(True)

If sucess Then

' init code, include code to either open main form (e.ShowMainForm = true) or exit the app

End If





Double check me, but this is my understanding of how it works.
By StrataFrame Team - 1/11/2007

Yep, Ivan and Greg are right... you'll want to test both the value of the ShowLoginAndAuthUser() method and your own method to check the license file.  So, you're code will look like this:

Private Shared Function IsLicenseOK() As Boolean
    '-- Test the license and return a value
End Function

Then, you would replace the login code with this:

e.ShowMainForm = Login.ShowLoginAndAuthUser(True) AndAlso IsLicenseOK()

You can use the "AndAlso" to test both values... if the first one fails (the user doesn't auth), then the second one is never evaluated.