CodeIgniter Forums
flexi auth - A user authentication library for CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: flexi auth - A user authentication library for CodeIgniter (/showthread.php?tid=54581)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-21-2013

[eluser]haseydesign[/eluser]
@vlados2

You ask a very good question there.
Unfortunately there is nothing currently in the library that will fix this for you, but I think you could implement your own solution fairly easily.

Basically, rather than checking the session for user permissions, make your own custom function to directly check the database instead.

An example SQL query using the default tables names within the library is as follows (Not tested).
Code:
$user_id = 1;
$privilege_id = 5;

$sql_where = array(
    'upriv_users_uacc_fk' => $user_id,
    'upriv_users_upriv_fk ' => $privilege_id
);

$query = $this->db->where($sql_where)->get('user_privilege_users');

if ($query->num_rows() > 0)
{
    // User is privileged!
}

This should generate an SQL query like:
Code:
SELECT *
FROM user_privilege_users
WHERE upriv_users_uacc_fk = 1 AND upriv_users_upriv_fk = 5

I hope that helps you out


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-21-2013

[eluser]haseydesign[/eluser]
Quote:I have been playing with flexi-auth and bolted it onto the front of a codeignitor app. Got it working fine on localhost but when i transferred it to my website, it won't redirect to my app. This is the message i get "The page isn't redirecting properly". Any ideas?

@Brenda (Via email),

This sounds like it's more a problem of your general Codeigniter setup rather than specifically with the flexi auth library.

My first guess would be that the 'RewriteBase' path within your .htaccess file is not set correctly.
The .htaccess file I'm referring to is located at the same directory level as your application and system folders.

By default the value is '/flexi_auth/', but if your installation is in your servers root public directory, it would just be '/'.

If this isn't the problem, then it could be the $config['base_url'] setting in the application/config/config.php file.
This would point to something like $config['base_url'] = 'http://www.website.com/';


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-21-2013

[eluser]haseydesign[/eluser]
Quote:How to set up email for sending forgotten password and confirm email.
Every time i send reset forgotten password i get Unable to reset password. error.
Can you please help me how to set up this to work?

@Miha (Via email)

There are quite a few things that could be the problem.

Firstly, ensure that you have a mail server setup on your local environment, I personally use http://www.hmailserver.com/

From there, the flexi auth library uses Codeigniters own email library to send emails, so before trying to send an email using flexi auth, just try and send one from a standalone demo page.
http://ellislab.com/codeigniter/user-guide/libraries/email.html

If this does work, then you most likely have configured something wrong with the flexi auth library.
The email settings are defined via the flexi auth config file, you can read up on them @ http://haseydesign.com/flexi-auth/user_guide/email_config
Note that the ‘email_template_directory’ must be located within the CI ‘views’ directory.

Once you’ve check the settings, then (If you haven’t already) install the flexi auth demo that is included with the download.
Once installed, try and create a new user using your email address, the registration process should send an email to you.

I know that in some of my previous attempts, that although it would successfully send the email to me, my email provider would never receive or spam the email as it was coming from a localhost address.
So if things look like they’re working, but you’re just not getting the email, try another address with another provider (Gmail etc).


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-21-2013

[eluser]charly71[/eluser]
Does anyone has installed this library on a secure environment?

My app is developed on a http virtual host like http://mydomain/app/index.php/home but I want the auth system be under SSL protocol like https://anotherdomain/appauth/index.php/...

The two CI installation can share the same DB.

Is that possible? Can I install the same library and then share the same "ci_sessions" table?

Any suggestion?

Thanks




flexi auth - A user authentication library for CodeIgniter - El Forum - 01-21-2013

[eluser]vlados2[/eluser]
@haseydesign
I thinked alot of this problem and I think the only solution is to store md5 of the permissions array and if it's changed to get permissions again


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-22-2013

[eluser]haseydesign[/eluser]
@charly71

Typically sessions cannot be managed between two different servers without a good degree of difficulty, although I believe it is meant to be possible.
In any case, it is not something that I have tried myself and so cannot directly help you with it.

However, it is possible to share session data between the http and https protocols when on the same server.
So a session on [bold]https[/bold]://www.website.com will be accessible on [bold]https[/bold]://www.website.com

------------------------------------------------------------------------------------------------------------------

@vlados2

If you have already got your solution working, then that's great - would you mind sharing the code with me to see what you have done?

However, from my understanding of your solution, I cannot see it working properly.
When a users privilege is changed, it is the database that is updated - not the logged in users session data.

Therefore if you take a hash of the users session privilege data, it is not going to be updated until the session expires.

My suggested solution posted above queries the database to get the live status of the users privileges and so should be 100% reliable.

If I have misunderstood your solution, then by all means, please correct me.





flexi auth - A user authentication library for CodeIgniter - El Forum - 01-22-2013

[eluser]ReyPM[/eluser]
I'm trying to use the library in my project but when I try to login I always come back to the logon form over and over again, I tested with admin@admin.com / password123 and admin/password123 and nothing, I'm doing something wrong or I miss a step?


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-23-2013

[eluser]haseydesign[/eluser]
@ReyPM

There could be a couple of issues causing your problem.

First off, when testing the demo, ensure you have not changed the following config setting within the flexi auth config file.
Code:
$config['security']['static_salt'] = 'change-me!';

This salt is used for hashing passwords and should only be changed when starting a new site, not for the demo.

If that isn't the problem, then it could be that you have an old PHP version on your server.
I'm not 100% sure what the minimum compatible version is, but I think 5.2+ should work.

Other than that, I would guess there may be a problem with your config setup.
In which case, try and install the library from scratch on a brand new Codeigniter installation following the user guide @ http://haseydesign.com/flexi-auth/user_guide/installation



flexi auth - A user authentication library for CodeIgniter - El Forum - 01-23-2013

[eluser]ReyPM[/eluser]
[quote author="haseydesign" date="1358931934"]@ReyPM

There could be a couple of issues causing your problem.

First off, when testing the demo, ensure you have not changed the following config setting within the flexi auth config file.
Code:
$config['security']['static_salt'] = 'change-me!';

This salt is used for hashing passwords and should only be changed when starting a new site, not for the demo.

If that isn't the problem, then it could be that you have an old PHP version on your server.
I'm not 100% sure what the minimum compatible version is, but I think 5.2+ should work.

Other than that, I would guess there may be a problem with your config setup.
In which case, try and install the library from scratch on a brand new Codeigniter installation following the user guide @ http://haseydesign.com/flexi-auth/user_guide/installation
[/quote]

Hi haseydesign and thanks for your reply but I didn't change the salt and also my PHP version is 5.3.18 (or the latest at CentOS repos) so any other suggestion regarding this problem? I really like to use your amazing library in my project because it have more than others (IonAuth, DX_Auth, Tank, etc)


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-26-2013

[eluser]Shinamee[/eluser]
Hello...

I found a nice simple way for codeigniter to connect facebook stellarfrequency.com and it works well when I tested it.

I want to use this code with flexi auth, not to sign in or register but simply just import some data. The problem I have comes from the "controller/autoload.php"

The default flexi auth autoload.php

Code:
/*
/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files.  Otherwise, leave it blank.
|
*/

$autoload['config'] = array();

The facebook connect autoload.php
Code:
/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array('database', 'session', 'form_validation', 'Facebook', 'Auth');


/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array('html', 'url', 'form');


/*
| -------------------------------------------------------------------
|  Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files.  Otherwise, leave it blank.
|
*/

$autoload['config'] = array('Stellar');

How can I solve this ... maybe a direction how I should configure those settings to match.

Thanks in advance.