pfc_logon


pfeapsrv.pbl   >   n_cst_appmanager   >   pfc_logon   

Full name n_cst_appmanager.pfc_logon
Access public
Extend of
Return value
Prototype event pfc_logon()

Name Datatype
No Data

Name Datatype
s_dbpassword string
s_dbuserid string

event pfc_logon;//////////////////////////////////////////////////////////////////////////////
//
//	Event:  pfc_logon
//
//	Arguments:
//	as_userid		User ID attempting to logon.
//	as_password		Password of user attempting to logon.
//
//	Returns:  integer
//	 1 = successful logon
//	-1 = failure
//
//	Description:  
//	Perform logon processing based on User ID and password given.
// If the Visual Guard security is activate, the application use the Visual Guard authentication 
// else the application use the database authentication.
//
//	Note:  
// Visual Guard loads the database parameters from the section [VG DATABASE].
// In this section the password is encrypted.
//
//	Subject:			VISUAL_GUARD
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	1.0.00   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © Novalys
//////////////////////////////////////////////////////////////////////////////
string s_dbuserid, s_dbpassword


IF IsValid (inv_vgsecurity) THEN
	// Use Visual Guard authentication

	IF not SQLCA.of_IsConnected () THEN
		// Load parameters from the INI-File
		IF SQLCA.of_init (of_GetAppIniFile (), "VG Database") = -1 then
			of_MessageBox ("pfc_systemerror", iapp_object.appname, &
				"File " + of_GetAppIniFile () + " not found", exclamation!, OK!, 1)
			Halt Close
		End if

		// Decrypt the password stored in the INI-File
		inv_vgsecurity.of_gettransid (SQLCA, s_dbuserid, s_dbpassword)
		inv_vgsecurity.of_settransid (SQLCA, s_dbuserid, inv_vgsecurity.of_decrypt (s_dbpassword))

		// Connect the application to the database
		IF SQLCA.of_connect () < 0 THEN
			of_MessageBox ("pfc_systemerror", iapp_object.appname, &
				"Unable to connect to the demo database.~r~n" + SQLCA.of_getsqlstate (), exclamation!, OK!, 1)
			HALT Close
		END IF
		inv_vgsecurity.of_settransobject (SQLCA)
	END IF		
	// Authenticates the user and loads security informations
	Return inv_vgsecurity.of_verifyuser (as_userid, as_password)
ELSE
	// Use the database authentication
	IF SQLCA.of_init (of_GetAppIniFile (), "Database") = -1 then
		of_MessageBox ("pfc_systemerror", iapp_object.appname, &
			"File " + of_GetAppIniFile () + " not found", exclamation!, OK!, 1)
		Halt Close
	End if
	IF SQLCA.DBHandle () > 0 THEN
		DISCONNECT USING SQLCA;
	END IF
	SQLCA.dbparm = Left (SQLCA.dbparm, len(SQLCA.dbparm) -1) + "UID = " + as_userid  + ";" + "PWD = " + as_password + "'"
	IF SQLCA.of_connect () < 0 THEN 
		of_MessageBox ("vg_logondenied", iapp_object.appname, &
			"Logon failed.", exclamation!, OK!, 1)
		Return -7
	END IF
END IF

Return 1

end event

     
Name Owner
No Data

     
Name Owner
transaction.dbhandle transaction
systemfunctions.isvalid systemfunctions
systemfunctions.left systemfunctions
systemfunctions.len systemfunctions
pfc_n_cst_appmanager.of_getappinifile pfc_n_cst_appmanager
pfc_n_base.of_messagebox pfc_n_base
pfc_n_tr.of_IsConnected pfc_n_tr
pfc_n_tr.of_Connect pfc_n_tr
pfc_n_tr.of_GetSqlState pfc_n_tr
pfc_n_tr.of_Init pfc_n_tr
vg_n_cst_vgmanager.of_decrypt vg_n_cst_vgmanager
vg_n_cst_vgmanager.of_verifyuser vg_n_cst_vgmanager
vg_n_cst_vgmanager.of_gettransid vg_n_cst_vgmanager
vg_n_cst_vgmanager.of_settransid vg_n_cst_vgmanager
vg_n_cst_vgmanager.of_settransobject vg_n_cst_vgmanager

     
Full name
demopfc

     
Name Scope
No Data