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

can't find component [model.beans.User] #11

Closed VTPhil95 closed 5 years ago

VTPhil95 commented 5 years ago

When registering a new user, I get the following error window after pressing the Register button:

ERROR! An error occurred!

Action: home:main.process Error: invalid component definition, can't find component [model.beans.User] Type: expression Details:

ddspringle commented 5 years ago

@VTPhil95 Sorry to hear you're having an issue. I'm afraid that error is pretty ambiguous tho - it could mean a number of different things:

  1. You may be missing all the files needed from the repo
  2. DI/1 may not be finding the component in your path
  3. File permission issue(s)

etc.

What does your environment look like? Are you running this in CommandBox, or do you have this set-up as a site on a server somewhere? Are you running Windows, OSx, Linux?

VTPhil95 commented 5 years ago

@ddspringle Thanks for the quick reply. I'm running CommandBox on Windows here.

Essentially all I did was: 1) Run box install fw1-sa 2) Run box start 3) Configure an object cache and datasource 4) Press the Register button on the new user page and I get that error.

I've been poking at the code a bit and one thing I noticed is that if I replace this line: https://github.com/ddspringle/framework-one-secure-auth/blob/master/home/controllers/main.cfc#L129

with this: rc.userObj =variables.beanFactory.getBean( "User" ); I'm able to create a blank User record.

ddspringle commented 5 years ago

@VTPhil95 Ah. Yeah the way box is installing it with the slug is a bit off from what I expected. I'll get that fixed up.

You'll want to cd into fw1-sa before starting up Lucee w/ box server start. I suspect that is the root cause - webroot needs to be inside the fw1-sa directory to find the right path to model.beans...

That said, yes more could be done with DI/1 instead of the new model.beans.... syntax to let DI/1 find and instantiate these beans, which would probably eliminate the pathing issue altogether regardless of where webroot ends up being.

For now, try starting up from inside the fw1-sa directory and let me know if the problem goes away.

VTPhil95 commented 5 years ago

@ddspringle Starting from inside the fw1-sa directory fixed it. Thanks for the quick help on this, I really appreciate it.

ddspringle commented 5 years ago

Sweet! Glad it is sorted. Lemme know if you have any other questions or need anything else!