Multifactor Authentication
Thanks for your help.
https://ishare.egd.enbridge.com
– you will see the Globalscape authentication.
FUNCTION enb_login
IF !ISNULL(osess)
RETURN .F.
ENDIF
****************
TRY
osessopt = CREATEOBJECT('winscp.sessionoptions')
err = .F.
CATCH
err = .T.
ENDTRY
IF err = .T.
= AERROR(_err)
=display_console('019', 'ER', _err(2))
RETURN
ENDIF
TRY
osess = CREATEOBJECT('winscp.session')
err = .F.
CATCH
err = .T.
ENDTRY
IF err = .T.
= AERROR(_err)
=display_console('020', 'ER', _err(2))
RELEASE osessopt
RETURN
ENDIF
TRY
otransopt = CREATEOBJECT('winscp.transferoptions')
err = .F.
CATCH
err = .T.
ENDTRY
IF err = .T.
= AERROR(_err)
=display_console('021', 'ER', _err(2))
RELEASE osessopt
RELEASE osess
RETURN
ENDIF
TRY
oresumesupport = otransopt.resumesupport
err = .F.
CATCH
err = .T.
ENDTRY
oresumesupport.state = 2 && turn off transfer to temporary file
IF err = .T.
= AERROR(_err)
=display_console('022', 'ER', _err(2))
RELEASE osessopt
RELEASE osess
RETURN
ENDIF
WITH otransopt
.transfermode = IIF(enbridge.transfer_mode = '01', 0, IIF(enbridge.transfer_mode = '02', 1, 2))
ENDWITH
WITH osessopt
.protocol =IIF(enbridge.protocol = '01', 0, 1)
.hostname = ALLTRIM(enbridge.url)
.username = ALLTRIM(enbridge.login_id)
.password = ALLTRIM(enbridge.password)
.sshhostkeyfingerprint = ALLTRIM(enbridge.host_key)
.portnumber = IIF(ALLTRIM(enbridge.port_number) = '01', '991', IIF(enbridge.port_number = '02', 22, ' '))
IF !EMPTY(ALLTRIM(enbridge.private_key_path))
.sshprivatekeypath = ALLTRIM(enbridge.private_key_path)
ENDIF
IF !EMPTY(ALLTRIM(enbridge.private_key_pass_phrase))
.sshprivatekeypassphrase = ALLTRIM(enbridge.private_key_pass_phrase)
ENDIF
ENDWITH
TRY
osess.open(osessopt)
err = .F.
CATCH
err = .T.
ENDTRY
IF err = .T.
= AERROR(_err)
=display_console('023', 'ER', _err(2))
RELEASE osessopt
RELEASE osess
RELEASE otransopt
RETURN
ENDIF
IF gm_bill_co = '4'
RETURN .F.
ENDIF
from_dir = '/Biller'+enbridge.biller_code
ofiles = osess.listdirectory(from_dir)
DIMENSION rem_fls(10)
FOR i = 1 TO ofiles.files.count
IF ofiles.files.item(i - 1).isdirectory = .T.
rem_fls(i) = '/'+ofiles.files.item(i - 1).name+'/'
ENDIF
ENDFOR
gm_remote_base_dir = ' '
FOR i = 1 to i
ofiles = osess.listdirectory(from_dir+rem_fls(i))
FOR j = 1 TO ofiles.files.count
IF ofiles.files.item(j - 1).isdirectory = .T.
IF ofiles.files.item(j - 1).name = 'Input'
gm_remote_base_dir = rem_fls(i)
RETURN .F.
ENDIF
ENDIF
ENDFOR
ENDFOR
RETURN .T.
ENDFUNC