ddspringle / framework-one-secure-auth

An example fw/1 application with secure single and two-factor (2FA) authentication and session management functions
Apache License 2.0
31 stars 5 forks source link

BaseBean issue? #12

Closed KrunchMuffin closed 5 years ago

KrunchMuffin commented 5 years ago

Hi,

Trying to implement this in my app but I am receiving the following error. I am using fw/1 4.2.

Problem with metadata for BaseBean (model.beans.BaseBean) because: Unable to getComponentMetadata(model.beans.BaseBean) because: Invalid CFML construct found on line 100 at column 84. (ColdFusion was looking at the following text:

(

The CFML compiler was processing:

  • An expression beginning with application.securityService.dataEnc, on line 100, column 32.This message is usually caused by a problem in the expressions structure.
  • A script statement beginning with return on line 100, column 25.
  • A script statement beginning with { on line 98, column 50.
  • A script statement beginning with if on line 98, column 17.
  • A script statement beginning with public on line 93, column 9.
), near line 100 in E:\cf\model\beans\BaseBean.cfc

any ideas?

ddspringle commented 5 years ago

@KrunchMuffin There are some known compatibility issues with ACF and this code. Mostly because I rarely use ACF and got used to running Lucee instead. That issue, in particular, is because ACF lacks the ability to properly parse bracket notation under very specific circumstances. A bug was raised with Adobe some years ago but was never addressed.

On line 100 and 104 of BaseBean.cfc you'll need to replace the code: this[ cf11fix ]() with evaluate( "get#getPrimaryKey()#()" ). and can subsequently remove line 95 which defines cf11fix (turns out that wasn't really a fix anyway, doh). I hate using evaluate(), but ACF leaves no choice here.

If you're using a version of ACF before 2018 then you'll also run into lots of issues with named parameters (which are not supported in ACF before 2018 and maybe not even all of them in 2018 but are supported in Lucee) to some functions and a handful of missing semi-colons at the end of lines (which are also not supported before ACF 2018 but are in Lucee).

I have an issue opened on this repo to address all of these issues for earlier versions of ACF but... unfortunately my time is short these days and I still prefer Lucee as the engine of choice for any work I do, under which this code performs just fine, so I haven't addressed them. If you do go through and eliminate all the ACF bugs, however, I would be most grateful for a pull request with those changes and will merge them into the repo for other ACF users (and add you as a contributor in the README, ofc).

Hope that helps and sorry about the compatibility issues.

ddspringle commented 5 years ago

Relates to #7

cfmaniac commented 3 years ago

I've found that changing Line 100: return application.securityService.dataEnc( this[ cf11fix ](), 'form' ); to return application.securityService.dataEnc( this[ 'cf11fix' ](), 'form' );

Line 104: return application.securityService.dataEnc( this[ cf11fix ](), 'url' ); to return application.securityService.dataEnc( this[ 'cf11fix' ](), 'url' );

Seems to resolve the Issue on ACF 11. Not Sure how it will function in Lucee however.