Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter
#11

[eluser]Klausch[/eluser]
I fixed the error, I had forgotten to copy the config file for the demosite...
THere is one other issue, the documentation mentions:

"Upon registration, new user accounts can be either automatically activated, sent an account activation email or suspended pending review by an admin."

But how can this be configured? I do not see a configuration option for this on the config file. Because I have no mail server running on my home server, I cannot test new accounts which require email validation...
So I would like to use, at least temporary, the option of automatical activation, i.e. without email confirmation. Is this possible?
#12

[eluser]haseydesign[/eluser]
Hey Klausch,

What you need to do to automatically activate user accounts is set the 'activate' argument as 'true' when inserting the user via the 'insert_user()' function.
You can read up on this function at http://haseydesign.com/flexi-auth/user_g...nsert_user

By setting the account activation to 'true', users will instantly be able to use their account. However, if you were wishing to just by-pass the activation email, and still have an admin review the account, then there is a setting in the config file to suspend all new accounts.

Code:
$config['settings']['suspend_new_accounts'] = true;
You can read up on this setting at http://haseydesign.com/flexi-auth/user_g...g_settings

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

A little off topic regarding not sending emails from the dev environment.
If the reason you've not got this running is the associated hassle setting it up (Setting up Mercury via Xampp was a nightmare for me), may I recommend try installing hmailserver, you can even associate the SMTP with a GMail account just for testing.

Another mail server I saw just yesterday was Mailcatcher, but I haven't personally tried this yet.

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

I'm interested in your comments regarding the database keys.
You're right that the foreign key constraints should be defined, I'll add this with my next round of tweaks.
Regarding some of primary keys being redundant, could you elaborate a little more on which fields you are referring to?
#13

[eluser]skunkbad[/eluser]
What I do for localhost email is just write the contents of the email to a log file, one for each email. It works well because you get to check for php errors.
#14

[eluser]Klausch[/eluser]
Thank you guys for your quick reactions!
For now I have found a solution for the mail problem: I installed ssmtp on my Ubuntu server machine and configured it to send mail using the SMTP server of my provider.
And this works, though I have no been able to deploy the demo version from my local machine to the server machine. The URL (***.localhost) is hardcoded in all controllers and I just had to change it each time when testing on my local machine or on the test server, which is a different machine on the local network.
Even in the comment is written that is os no good practice and I see really no reason to hard code a URL or directory in all controller classes while the base url is already defined in the config file.

I am struggling with the rest of the code, too. I do not understand the separation between the normal and lite versions of the code, a very basic function as login() is defined in the Flexi_auth library class, so what is the point in defining a _lite superclass which has no login functionality defined so is hardly usable by itself?
Or is the lite version meant to be used only by the controller methods for already logged in users?

To make my confusion worse, when installing the non-demo version, the two model classes (flexi_auth_lite_model and flexi_auth_model) do not define a login() method. So do I need to copy the code from the demo model classes?

SO right now I am utterly confused by this code and the distinction between lite/not-lite as well as between demo/nondemo versions.
I will give it one more day before deciding to go on with it or get back to the original IonAuth.
#15

[eluser]karanits[/eluser]
i am getting PHP errors while trying to login while opening auth/index
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$session_name
Filename: libraries/Flexi_auth_lite.php
Line Number: 172

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$session_data
Filename: libraries/Flexi_auth_lite.php
Line Number: 172

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$tbl_col_user_account
Filename: models/flexi_auth_model.php
Line Number: 1940

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$tbl_col_user_account
Filename: models/flexi_auth_model.php
Line Number: 1941

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$auth_security
Filename: models/flexi_auth_model.php
Line Number: 1941

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$tbl_user_account
Filename: models/flexi_auth_model.php
Line Number: 1945

This makes
Code:
$this->auth->tbl_user_account NULL in function ip_login_attempts_exceeded()
thereby giving database error in the end.

Weird thing is checking value in its constructor gives the right value. I have checked this with a new installation of CI and Flexi

what am i doing wrong?
#16

[eluser]haseydesign[/eluser]
@Klausch

Let me try to clear up some of your confusion.

The split between the 'lite' library and the 'main' library should be considered a feature, it is not a requirement.
Whenever you include the main library, it extends the lite library meaning functions in both versions are available to you.
If you want to include the main library on every page, that is fine, it will just consume a little more memory on every page load.

The easiest way to look at the purpose of each library version is this:

+ The lite library is used to getting user data, and for checking user credentials - things that you are likely to need to do on every page load - e.g. checking whether a user is logged in and then displaying their name.

+ The main library is the work horse, performing actions like login, registration and forgotten password functionality. You are likely to only need to use these functions when a specific action happens, like a login form being submitted.

An example of the how/why you would use the lite library can be seen at http://haseydesign.com/flexi-auth/auth_l...te_library (Login as different demo users to see how different data is returned).

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

Regarding you not being able to find the login() method in either model, its in the 'flexi_auth_model', but there is no reason for you to change any data within any of the flexi auths model or library files.
The demo models are purely for the examples within the demo site and have no part in how flexi auth works - they are examples of how to use flexi auth functions within a website.

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

Regarding the 'base_url' being defined in each controller, this is purely for the purposes of the demo so that it is easier for users to quickly get setup and running.
The 3 vars that are set within each controller are defined there so that they are available for creating href link paths within Views.
It is not used in the same was as the 'base_url' defined within CI's config.php file that is used for routing.
#17

[eluser]haseydesign[/eluser]
@karanits

I would presume there is an incorrect setting somewhere in the flexi_auth config file, but without looking at your setup it hard to know what the specific problem is that's causing the error.

What I would suggest is that you start a brand new bare installation of CI and flexi auth, then run through the installation guide @ http://haseydesign.com/flexi-auth/user_g...stallation
It is very important that this guide is closely followed, as the slightest omission can cause errors.

Then just follow examples within the demo files on how to setup your controller and a basic view file.
Do not get complicated from the start, just have a simple form within the view file that gets a user to login and see how it goes.

To give you some example data, you may want to use the sql dump and the flexi auth config files from the demo to give you a head start.
Once you get the basics working, then customise the database tables and config file settings to your requirements.
#18

[eluser]karanits[/eluser]
@haseydesign
I found the issue. the errors come when 'form_validation' library is auto-loaded in beginning. Is there a specific reason for this error or is it still my installation issue.

PS: this time i did a complete new install.
#19

[eluser]haseydesign[/eluser]
@karanits

That actually sounds like that's a bug with the library, something that I will try and test out ASAP.
I'll keep you posted with my testing.

Thanks for reporting this.
#20

[eluser]Klausch[/eluser]
[quote author="haseydesign" date="1348100384"]@Klausch

Let me try to clear up some of your confusion.

The split between the 'lite' library and the 'main' library should be considered a feature, it is not a requirement.
Whenever you include the main library, it extends the lite library meaning functions in both versions are available to you.
If you want to include the main library on every page, that is fine, it will just consume a little more memory on every page load.

The easiest way to look at the purpose of each library version is this:

+ The lite library is used to getting user data, and for checking user credentials - things that you are likely to need to do on every page load - e.g. checking whether a user is logged in and then displaying their name.

+ The main library is the work horse, performing actions like login, registration and forgotten password functionality. You are likely to only need to use these functions when a specific action happens, like a login form being submitted.

An example of the how/why you would use the lite library can be seen at http://haseydesign.com/flexi-auth/auth_l...te_library (Login as different demo users to see how different data is returned).

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

Regarding you not being able to find the login() method in either model, its in the 'flexi_auth_model', but there is no reason for you to change any data within any of the flexi auths model or library files.
The demo models are purely for the examples within the demo site and have no part in how flexi auth works - they are examples of how to use flexi auth functions within a website.

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

Regarding the 'base_url' being defined in each controller, this is purely for the purposes of the demo so that it is easier for users to quickly get setup and running.
The 3 vars that are set within each controller are defined there so that they are available for creating href link paths within Views.
It is not used in the same was as the 'base_url' defined within CI's config.php file that is used for routing.[/quote]

Hi, thanks again for your reply. I think I am getting things a bit better now.
I made a sketch for myself to clear up some issues, I understand now that the flexi_auth_model class just extends the flexi_auth_model lite class and for the first tests I can just use the subclass version.

Other issue was the demo model classes which I first considered to be a replacement for the core model classes, but now I understand that they are just another layer:
Summarized the layers can be shown as follows:

Code:
|---------- DEMO  FILES --------------------|  |---------- CORE FLEXIAUTH LIBRARY FILES ----|
views <--- demo controllers --&gt; demo model -> library --&gt;l ibrary model ---&gt; database tables
Remains the issue of the 3 vars in each controller, I think is is still messy that they should be modified in 5 places or so, and a constant could be better defined for it, but maybe I am missing something yet...
After talking to my project leader we continue evaluating FlexiAuth and will tryo to set up a basic register/login system next weeks. So I will keep you informed...





Theme © iAndrew 2016 - Forum software by © MyBB