EllisLab text mark
Advanced Search
2 of 6
2
   
Looking for people to give feedback on Community Auth
Posted: 19 March 2012 05:12 PM   [ Ignore ]   [ # 16 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

I made some changes to the repo, and hopefully these changes are all that is necessary for the uploader to work for everyone. I basically am hand crafting a upload path using FCPATH, which is absolute. I tested it here (Windows/XAMPP) and on community-auth.com (Linux/Litespeed), and all is well. If you guys can do some testing with the new code, I’d appreciate it. Let me know how it goes.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 20 March 2012 03:08 AM   [ Ignore ]   [ # 17 ]   [ Rating: 0 ]
Joined: 2012-03-18
3 posts

Hey Brian,

Merged your new code, upload stuff is clearer, but I think we’re confusing things!

For example, I have your app setup under a local, htdocs subdirectory, exactly under: /projects/sandbox/auth

If I change ...application/config/uploads_manager.php as you said:

$config['upload_dir''/projects/sandbox/auth/upload_directory'

That makes the upload to fail, error given is ‘callback failed’ on JS alert message.

Change again to:

$config['upload_dir''upload_directory'

So, ok, your comment on $config[‘upload_dir’] is “Upload_dir must be a single public root level directory”, BUT the fact is the file is correctly uploaded to the correct subdirectory, under /projects/sandbox/auth/upload_directory <—- so the upload is CORRECT, no JS alert, the problem is for some reason you’re writing an absolute path to the database: table user_profiles, field profile_image, it gets: /upload_directory/profile_images… instead of the correct location of the file, that landed on /projects/sandbox/auth/upload_directory

And so the div id=“profile_image” gets populated with an img src=”/upload_directory/profile_images”... which is not found wink

Upload is working, it’s just a matter of database/showing the image problem.

Hope that helps!

 

 
Posted: 20 March 2012 04:41 AM   [ Ignore ]   [ # 18 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

OK, I fixed it. Please use a single public root level directory for upload_dir. It won’t work without doing that.

I created a installation of Community Auth in a sub-directory with the same location as yours:

/projects/sandbox/auth

I put this in my httpd-vhosts.conf:

<VirtualHost *:80>
 
ServerName localhost.projects
 DocumentRoot 
"C:\xampp\htdocs\projects"
</VirtualHost>
<
VirtualHost *:443
 
DocumentRoot "C:\xampp\htdocs\projects"
 
ServerName localhost.projects
 SSLEngine on 
 SSLCertificateFile conf
/ssl.crt/server.crt 
 SSLCertificateKeyFile conf
/ssl.key/server.key 
</VirtualHost

I changed the RewriteBase in my .htaccess to this:

RewriteBase /sandbox/auth/

So at this point, I probably have the exact same thing as you.

1) I went in and fixed the references to images in the style.css file.

2) I changed the file_url() method in MY_Upload to this:

public function file_url$full_path )
{
 
// Get all URI segments of the file upload location
 
$path_parts explode('/'$full_path);

 
// Initialize variable to track if upload_dir has been reached when looping through $path_parts
 
$target_dir FALSE;

 
// Initialize variable to hold our image path to pass to base_url()
 
$file_url '';

 
// Loop through $path_parts
 
for( $x=0$x <= count$path_parts ) - 1$x++ )
 
{
  
// If this parth part is the upload_dir, or if the upload_dir has already been reached
  
if( $path_parts[$x] == $this->upload_dir OR $target_dir === TRUE )
  
{
   
// Build on to the path to pass to base_url()
   
$file_url .= ( $target_dir ) ? '/' $path_parts[$x] $path_parts[$x];

   
$target_dir TRUE;
  
}
 }

 
// Return the URL to the image
 
return base_url$file_url );

Now it works. Changes are also in the repo.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 20 March 2012 06:08 AM   [ Ignore ]   [ # 19 ]   [ Rating: 0 ]
Joined: 2012-03-18
3 posts

Aha, merged and now works. Don’t worry too much, that should be enough for those of us expecting it to work under subdirectories wink

Just two notes:

1) I don’t understand when you say “Please use a single public root level directory for upload_dir. It won’t work without doing that.”

The image is indeed created into /projects/sandbox/auth/upload_directory, there is no ‘upload_directory’ dir at my webroot. Promise.

2) When I was trying that, I manually erased my profile image file from the upload_directory under ‘sandbox/auth/upload_directory’, just to see it’s being created there. After doing that, upload failed every time with an error about ‘token’ (your csfr protection). Refreshing page or logout/login again didn’t help. I figured out to manually set blank the profile_image field under user_profiles table on database and then upload worked again. Just to let you know.

Sorry for the excessive feedback and issues :D

Juanga

 
Posted: 20 March 2012 10:53 AM   [ Ignore ]   [ # 20 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

The reason why the upload dir needs to be a single dir is the file url ( shown above ) method is looking for it to match a segment of the upload path after exploding the path. It would never match if a slash appears in the upload dir.

Next, the uploader doesnt work after deleting the image from the filesystem because the token is instantly used by the 404 created by the missing image. The image would never be missing under normal circumstances.

It did not matter f you had created the upload dir because mkdir() is doing recursive making of dirs, hence the third parameter of mkdir().

Hope everyone now has a good uploader experience. Thanks for testing. I would have never known about this problem, or have been able to fix it, without this feedback.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 21 March 2012 05:47 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Joined: 2012-02-29
6 posts

Thanks Brian,

The profile picture works perfectly ok. Thanks for fixing the error, like I said I will always recommend community auth to people. grin

 
Posted: 22 March 2012 12:13 AM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts
Shawller - 21 March 2012 05:47 PM

Thanks Brian,

The profile picture works perfectly ok. Thanks for fixing the error, like I said I will always recommend community auth to people. grin

Prince, glad to hear it’s working for you.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 01 April 2012 02:33 AM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

I just added a custom uploader to Community Auth, and could use some testers. The uploader controls allow for drag and drop re-ordering of images, and drag to trash deleting of images. It uses jQuery UI sortable, droppable, draggable, etc. This uploader not in the isolated downloads yet, only the tip. Anyways, let me know how it goes if you have the time to test it out.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 09 April 2012 02:48 PM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Joined: 2012-03-04
9 posts

Hi,

After some trouble with the download link, I eventually did get to download without the site giving a 404. Now on the dowload site I downloaded and set up the module. However, as I am a near virging in CI, I have serious troubvle getting it set up. In your manual you state it is so symple to install, a manual is not needed. I do disagree. I keep getting 404 errors when trying to get to http://localhost/vraagje/index.php/init

My CI install sits under http://localhost/vraagje/

The logs show an error when it comes to sessions:
DEBUG - 2012-04-09 11:32:52—> Config Class Initialized
DEBUG - 2012-04-09 11:32:52—> Hooks Class Initialized
DEBUG - 2012-04-09 11:32:52—> Utf8 Class Initialized
DEBUG - 2012-04-09 11:32:52—> UTF-8 Support Enabled
DEBUG - 2012-04-09 11:32:52—> URI Class Initialized
DEBUG - 2012-04-09 11:32:52—> Router Class Initialized
DEBUG - 2012-04-09 11:32:52—> Output Class Initialized
DEBUG - 2012-04-09 11:32:52—> Security Class Initialized
DEBUG - 2012-04-09 11:32:52—> Input Class Initialized
DEBUG - 2012-04-09 11:32:52—> Global POST and COOKIE data sanitized
DEBUG - 2012-04-09 11:32:52—> Language Class Initialized
DEBUG - 2012-04-09 11:32:52—> Loader Class Initialized
DEBUG - 2012-04-09 11:32:52—> Config file loaded: application/config/db_tables.php
DEBUG - 2012-04-09 11:32:52—> Config file loaded: application/config/authentication.php
DEBUG - 2012-04-09 11:32:52—> Helper loaded: html_helper
DEBUG - 2012-04-09 11:32:52—> Helper loaded: url_helper
DEBUG - 2012-04-09 11:32:52—> Database Driver Class Initialized
DEBUG - 2012-04-09 11:32:52—> Session Class Initialized
DEBUG - 2012-04-09 11:32:52—> Helper loaded: string_helper
DEBUG - 2012-04-09 11:32:52—> Encrypt Class Initialized
DEBUG - 2012-04-09 11:32:52—> Session routines successfully run
DEBUG - 2012-04-09 11:32:52—> Model Class Initialized
DEBUG - 2012-04-09 11:32:52—> Model Class Initialized
DEBUG - 2012-04-09 11:32:53—> Controller Class Initialized
DEBUG - 2012-04-09 11:32:53—> Model Class Initialized
DEBUG - 2012-04-09 11:32:53—> Helper loaded: form_helper
DEBUG - 2012-04-09 11:32:53—> Session class already loaded. Second attempt ignored.
ERROR - 2012-04-09 11:32:53—> 404 Page Not Found—>
ERROR - 2012-04-09 11:32:53—> Severity: Warning —> file_get_contents(http://localhost/custom_error_page/error_404?heading=404+Page+Not+Found&message=The+page+you+requested+was+not+found.) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
C:\xampp\htdocs\vraagje\application\errors\error_404.php 17

Any suggestions?

 
Posted: 09 April 2012 03:37 PM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

There is documentation, and if followed installation is easy, especially if you already have experience with CI. I don’t know what the problem with bitbucket is today, but it sounds like you may have got a corrupt download, because the php error is claiming that a file does not exist. I can send you a zip if you private message me your email address.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 09 April 2012 05:12 PM   [ Ignore ]   [ # 26 ]   [ Rating: 0 ]
Joined: 2012-03-04
9 posts

Hi Brian,

Thanks for the help so far, here and over the email.

In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!

 
Posted: 09 April 2012 07:08 PM   [ Ignore ]   [ # 27 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts
leatherback - 09 April 2012 05:12 PM

Hi Brian,

Thanks for the help so far, here and over the email.

In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!

I’m going to make this more clear in the documentation. The documentation needs to be reviewed because it’s a couple of weeks old. Thanks for your feedback.

Edit: I just updated the documentation.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 11 April 2012 06:36 PM   [ Ignore ]   [ # 28 ]   [ Rating: 0 ]
Avatar
Joined: 2012-04-11
7 posts

First, thank you for the Community Auth code!! 

I’m just starting to work through it, and am a newbie with CI.  I have a question regarding how to integrate Community Auth with an existing CI installation?  I’ve tried cherry picking the files and folders that looked different, and merging code that was different between other files, but this seems like an insane approach (especially since I’m only about a week into CI coding), and I’m trying to do this with other tools similar to yours (ex. CarboGrid).  Seems like an approach that is destined to failure, so again, as a newbie, I’m thinking I’m approaching this the wrong way.  I realize this is a more generic question (I apologize for that), but I’m dying to get the Community Auth stuff working, as it looks to be exactly what I’ve been looking for, and one of the reasons I’ve started working with the whole CI framework.

Thank you.

 
Posted: 11 April 2012 11:45 PM   [ Ignore ]   [ # 29 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts

Monkey, just download the newest ‘isolated” version on the downloads page. That version is not pre-installed in CI. The only thing to watch out for is when you have a file that is the same as one in the download, like one of the config files. You just want to see what I put in mine vs yours so you can do whatever it takes to make it work ya know.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 13 April 2012 11:10 AM   [ Ignore ]   [ # 30 ]   [ Rating: 0 ]
Avatar
Joined: 2012-04-11
7 posts

Hey Brian - Just wanted to let you know I ended up just downloading the full version.  Figured, as a newbie, I was jumping in way too deep off the bat.  I do now have Community Auth up and running, and WOW, looks like you really thought of everything.

I did run into two very minor things that tripped me up during the install/setup, and wanted to pass along as possible updates to the documentation to help others.  These may be just newbie things, so take these suggestions with that in mind:

A) Step 3 “Edit and Run Init Controller” - you might add a note specifically for the $disabled setting to “set this to FALSE as your first step before trying to run init.php”.  I know this seems completely obvious now, but after installing and making all the config changes, I didn’t know what this setting did and left it alone.  The result of keeping this TRUE unfortunately looks identical to he issue leatherback reported running into with the .htaccess issue (my log looked identical to his log output), so I ended up spending way too much time tweaking .htaccess stuff.  Again, turned out I just hadn’t changed the $disabled setting.

B) Then the first thing to do once you have everything up and running, is go to the “Registration Mode” page to enable registration.  Again, very minor, but took me a while to figure out why I couldn’t create registrations, and spent too much time going back through the installation and configuration side of things to figure out what I had wrong.

Again, awesome job on this - I’m amazed at all the features, like the Registration Mode - very complete set of options!  I hope to get into it pretty deep next week.

 
2 of 6
2