about form

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by Tom >> Tue, 6 Jan 2004 17:13:39 GMT

If I have 2 forms, the first form is main form and second form is Login form. When I run the application it always show only the main form .How can I show the login form and then main form after authenticate? Thanks

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by cnwdad1 >> Tue, 6 Jan 2004 20:48:55 GMT

Check out the documentation for the Global class (in the EncycloSys.pdf file), specifically the "getAndValidateUser" method. Here's an example which I have implemented on my application schema's Global subclass:

getAndValidateUser(usercode: String output; password: String output): Boolean;

vars
logonFormObj : ProjectLogonForm;
begin

create logonFormObj;

if logonFormObj.showModal() = CnEcBaseForm.CNEC_MODAL_UPDATE then
logonFormObj.getUserNamePassword(usercode, password);
return true;
else
return false;
endif;
end;

JADE will invoke this method BEFORE the application actually starts. It is a very simple implementation, but basically what it does is show a logon form to capture the usercode and password from the user. The logon form itself handles the validation of the usercode and password - if they are valid, then the form's "modalResult" value will be set to the value of the CNEC_MODAL_UPDATE (which is a class constant on the CnEcBaseForm class).

If the method returns true, then the application will be started, otherwise the application will not run.

regards,
darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by tom >> Mon, 12 Jan 2004 16:48:31 GMT

Regarding to previous message,where should I create "getAndValidateUser" method? for example my Schema's name is SayHello. I create method at GSayHello,is it right?

Object
|+Application
|-Global
| |-RootSchemaGlobal
| |-GSayHello <----- Here?

This is mine "getAndValidateUser" code:
getAndValidateUser(usercode: String output; password: String output): Boolean;

vars
form :Logon;
begin
if app.applicationType = Application.ApplicationType_GUI then
create form;
form.showModal;
usercode := form.user.text;
password := form.pass.text;
return true;
else
return inheritMethod(usercode, password);
endif;
end;

This is mine "isUserValid" code :(Do I need it?)
isUserValid(usercode, password :String) :Boolean serverExecution;
vars
user :User; <- What "User" in this line mean?
begin
user := app.myRoot.allUsers[usercode];
if user = null then
return false;
endif;
if user.password not = password then
return false;
endif;
return true;
end;
Do I need any more methods and where would store username and password? Is there easier way to create user authentication form?Could you be more elaborate? thank you very much.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by cnwdad1 >> Mon, 12 Jan 2004 20:51:42 GMT

Yes, your "getAndValidateUser" method would go on the "GSayHello" class. Your example appears okay to me. The user code that is returned by the "usercode" output parameter is held by the "signOnUserCode" and "userCode" properties of the "Process" class. At run-time, you can access these properties by referencing the "process" system variable, for example:

write process.userCode;

You could also (re)implement the "isUserValid" method on your GSayHello class, but generally it's not neccessary.

Regarding your query about an easier way to create a user authentication form, I'm not sure what you want - the bottom line is that you need some way of capturing the user code, and optionally a password, from the user, and then validating it against data stored in the database, i.e. an instance of one of your classes, typically "User" or something similar.

regards,
darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by tom >> Mon, 12 Jan 2004 16:48:44 GMT

Regarding to previous message,where should I create "getAndValidateUser" method? for example my Schema's name is SayHello. I create method at GSayHello,is it right?

Object
|+Application
|-Global
| |-RootSchemaGlobal
| |-GSayHello <----- Here?

This is mine "getAndValidateUser" code:
getAndValidateUser(usercode: String output; password: String output): Boolean;

vars
form :Logon;
begin
if app.applicationType = Application.ApplicationType_GUI then
create form;
form.showModal;
usercode := form.user.text;
password := form.pass.text;
return true;
else
return inheritMethod(usercode, password);
endif;
end;

This is mine "isUserValid" code :(Do I need it?)
isUserValid(usercode, password :String) :Boolean serverExecution;
vars
user :User; <- What "User" in this line mean?
begin
user := app.myRoot.allUsers[usercode];
if user = null then
return false;
endif;
if user.password not = password then
return false;
endif;
return true;
end;
Do I need any more methods and where would store username and password? Is there easier way to create user authentication form?Could you be more elaborate? thank you very much.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by tom >> Mon, 12 Jan 2004 16:49:14 GMT

Regarding to previous message,where should I create "getAndValidateUser" method? for example my Schema's name is SayHello. I create method at GSayHello,is it right?

Object
|+Application
|-Global
| |-RootSchemaGlobal
| |-GSayHello <----- Here?

This is mine "getAndValidateUser" code:
getAndValidateUser(usercode: String output; password: String output): Boolean;

vars
form :Logon;
begin
if app.applicationType = Application.ApplicationType_GUI then
create form;
form.showModal;
usercode := form.user.text;
password := form.pass.text;
return true;
else
return inheritMethod(usercode, password);
endif;
end;

This is mine "isUserValid" code :(Do I need it?)
isUserValid(usercode, password :String) :Boolean serverExecution;
vars
user :User; <- What "User" in this line mean?
begin
user := app.myRoot.allUsers[usercode];
if user = null then
return false;
endif;
if user.password not = password then
return false;
endif;
return true;
end;
Do I need any more methods and where would store username and password? Is there easier way to create user authentication form?Could you be more elaborate? thank you very much.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by allistar >> Tue, 13 Jan 2004 4:41:49 GMT

A question about this:

Is there a way in getAndValidateUser of determining if the current node is from the ODBC driver? I mentioned previously that I would look into the Windows module list to see if jadodbc.dll is loaded, but that is too hacky for my liking.

Basically I want to use getAndValidateUser to validate ODBC connections only.

Thanks,
Allistar.

------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by cnwdad1 >> Tue, 13 Jan 2004 19:57:49 GMT

I haven't done this, so I can't speak from experience. However, have a read of the Object Manager documentation (ObjectManager.pdf). In Chapter 2, there's a section called "User-Validation Support". It would appear that your requirement to validate an external process is a good reason to implement the "isUservalid" method (i.e. secondary server-side user validation). I'm not sure how you actually determine whether the user is an ODBC client though... are there any clues in the property values of the "process" global variable ?

regards,
darrell.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by allistar >> Thu, 15 Jan 2004 2:58:40 GMT

As far as I can tell neither the app, process or node global variables betray the fact that this node is from the ODBC driver.

Thanks anyway,
Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: about form

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:29 pm

by dr >> Thu, 15 Jan 2004 0:04:46 GMT

The Jade ODBC driver configuration requires an application name. If you define an application dedicated to this purpose then can you can use this to identify an ODBC source.
(I haven't used this for a long time until now, in Jade 6 ... not sure if this is a recently provided feature?)

Cheers,
Rob


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests