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 - 12-16-2012

[eluser]katanama[/eluser]
@haseydesign

Hi...

I'm a bit confused between uacc_suspend and uacc_active

1. I suppose uacc_active is for recording wether or not the user account has been activated, like by clicking confirmation link with token in email.

2. and uacc_suspend, I assume is for admin to mark if an account should or should not be allowed to login.

3. An Admin should block a user he really hate by setting uacc_suspend, and for other reason which may see the user able to login again (like disabling account that have not logged in for more than 3 months) the Admin panel logic should implement the activate/deactivate (uacc_active) method.

correct?

I'm asking because there's no library for suspending/unsuspend... assuming i should access the uacc_suspend directly without going thru library... is that correct?


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-16-2012

[eluser]Unknown[/eluser]
how to create 3 table joint ??

thx


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]haseydesign[/eluser]
@katanama

Your assumptions on the differences between 'activate' and 'suspend' sound like they are correct.

'uacc_active' indicates whether the user has performed an additional action to verify their account is genuine and valid.
Typically (As in the demo), an account is activated by the user clicking an emailed link containing a validation token that verifies the users email address is valid.

'uacc_suspend' defines whether a user should be allowed to login to their account, regardless of whether they have activated their account or not. You can use this for whatever reason you desire, it can be temporary or permanent, but when set as '0', the user will not be able to login.

To set the 'uacc_suspend' value, you would use the 'update_user()' function.
http://haseydesign.com/flexi-auth/user_guide/user_account_set_data#update_user

Code:
$user_id = 101;
$user_data = array('uacc_suspend' => '0');

$this->flexi_auth->update_user($user_id, $user_data);



flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]haseydesign[/eluser]
@abdialeh

The included demo includes an example of a 3 table join between the custom demo 'user_profile' and 'user_address' tables and the required ''user_acc' table.


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]katanama[/eluser]
[quote author="haseydesign" date="1355825547"]@katanama

Your assumptions on the differences between 'activate' and 'suspend' sound like they are correct.

'uacc_active' indicates whether the user has performed an additional action to verify their account is genuine and valid.
Typically (As in the demo), an account is activated by the user clicking an emailed link containing a validation token that verifies the users email address is valid.

'uacc_suspend' defines whether a user should be allowed to login to their account, regardless of whether they have activated their account or not. You can use this for whatever reason you desire, it can be temporary or permanent, but when set as '0', the user will not be able to login.

To set the 'uacc_suspend' value, you would use the 'update_user()' function.
http://haseydesign.com/flexi-auth/user_guide/user_account_set_data#update_user

Code:
$user_id = 101;
$user_data = array('uacc_suspend' => '0');

$this->flexi_auth->update_user($user_id, $user_data);
[/quote]

Thank you!

I'm impressed by your diligence in answering our questions.
May god bless you.

The solution you give, using update_user() is also elegant, I didn't thought about it... I accessed the db directly and am going to change my codes, it's shorter and semantically pleasing.


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]xuma[/eluser]
Hi

Yet again i have problem with
Code:
sess_use_database
.

When i switch TRUE flexi_cart works fine but i cant login with flexi_auth , when i switch FALSE flexi_auth works fine but flexi_cart stops working.

Here what i tried when search for problem ;

Quote:Increase session expire time(timezone problems)
Change timezone
Checked encryption_key,csrf_protection(TRUE)
Increase csrf_expire
Changed usess_series varchar(40) to 256

Checked progress;
getting true from flexi_auth->login (flexi_auth library).
getting false from public function is_logged_in().In this function ;

Code:
$this->auth->session_data[$this->auth->session_name['user_id']] = $user_id;
$this->auth->session_data[$this->auth->session_name['user_identifier']] = $user->{$this->auth->primary_identity_col};
working fine.It fails on this part
Code:
$this->session->set_userdata(array($this->auth->session_name['name'] => $this->auth->session_data))
Dump of this array
Code:
( array($this->auth->session_name['name'] => $this->auth->session_data) )

Code:
Array
(
    [flexi_auth] => Array
        (
            [login_session_token] => 65be0fa48181f4f2a4b84e78816de49065611325
            [logged_in_via_password] => 1
            [user_id] => 99
            [user_identifier] => [email protected]
            [admin] => 1
            [group] => Array
                (
                    [3] => Master Admin
                )

            [privileges] => Array
                (
                )

        )

)
Now updating php version to 5.3 on server.


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]katanama[/eluser]
@xuma

have you checked your database?

maybe column name mismatch....

did you create your own table? or did you copy the schema from the demo?


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]jasonlally[/eluser]
I am currently getting this error on the demo when purposefully submitting a registration with errors. I'm trying to test the messages:

Fatal error: Cannot access protected property Auth::$data in /[my directory]/application/models/demo_auth_model.php on line 10

Registration happens perfectly when I don't try to trip it up. Line 10 is the return of the following function in the Demo_auth_model class:

Code:
public function &__get($key)
{
  $CI = get_instance();
  return $CI->$key;
}

Any idea what could be causing this? Oddly the comment says this function is explicitly to avoid this error:

// The following method prevents an error occurring when $this->data is modified.

But I'm still getting it. I'm on CodeIgniter 2.1.3


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]katanama[/eluser]
[quote author="jasonlally" date="1355896985"]I am currently getting this error on the demo when purposefully submitting a registration with errors. I'm trying to test the messages:

Fatal error: Cannot access protected property Auth::$data in /[my directory]/application/models/demo_auth_model.php on line 10

Registration happens perfectly when I don't try to trip it up. Line 10 is the return of the following function in the Demo_auth_model class:

Code:
public function &__get($key)
{
  $CI = get_instance();
  return $CI->$key;
}

Any idea what could be causing this? Oddly the comment says this function is explicitly to avoid this error:

// The following method prevents an error occurring when $this->data is modified.

But I'm still getting it. I'm on CodeIgniter 2.1.3[/quote]

I'm also new to Flexi Auth and beginner in PHP, but let me try to help you.

1. Are you using HMVC extension? Which one?

2. How do you declare your $data in your controller?
- As a class member properties, or?
- as a method variable, or?
- in the constructor as a new stdClass like in the demo?

&__get($name) is a PHP magic method that handle overloading.

Quote:http://php.net/manual/en/language.oop5.overloading.php#object.get

public mixed __get ( string $name )

The $name argument is the name of the property being interacted with.

Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. As of PHP 5.3.0, a warning is issued if one of the magic overloading methods is declared static.



flexi auth - A user authentication library for CodeIgniter - El Forum - 12-18-2012

[eluser]jasonlally[/eluser]
I was able to find the root cause, but still searching for a solution. I have a core MY_Controller extending CI_Controller. I had switched the Auth controller to extend MY_Controller to take advantage of some template functions I'm using across my controllers. Anyway, when I switch Auth to extend CI_Controller again, everything is fine again. So I guess the key question is what happens to the __get($key) magic function when I extend the core CI_Controller? What is breaking? Do I need to declare something in my constructor for MY_Controller so $CI can get the main instance via get_instance still.