Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]digital_frog[/eluser]
sevengraff, it may be possible to search the database by date to see who is logged. Adding a logged-in flag to the user table may also work, but I'm pretty sure something may already exist with how the sessions work that may do that.


On another note, I may have found a bug with how log-ins are handled. While I was testing account permissions on pages, I was able to access my admin page from an account classified as a student. (These are set by the built in group functions) I was logged in as the administrator before I logged in as the student, but I never logged out of the admin account. I think it may be possible to be logged in a two users at once, either that or the student account session somehow inherited something from the admin session. Once I cleared my cookies, the student account no longer had access to the page. Of course I will not be enabling the login box if there is a user logged in, but I thought this would be something worth mentioning.

[eluser]digital_frog[/eluser]
I kind of broke my site with this, and was wondering if anyone knows what to do.

I have installed Ion_Auth into my site to replace a simple login I made from a tutorial video. The install worked and I began the process of converting the site to use Ion_Auth, so teacher/student and admin pages are protected by groups now, and logging in works from [http://localhost/example/auth/login]

The problem comes from trying to make logging in from the site main page instead of auth/login page. When I try to load the auth/login view into site.php, it gives me these error messages when I access the site:


A PHP Error was encountered

Severity: Notice

Message: Undefined variable: message

Filename: auth/login.php

Line Number: 7

Email/Username:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: identity

Filename: auth/login.php

Line Number: 13

Password:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: password

Filename: auth/login.php

Line Number: 18


My front page is created by site.php, and auth.php is a separate controller. I tried copy/pasting auth.php into site.php, but that didn't seem to work. (My logic being that everything should be defined auth.php) I am still fairly new to codeigniter and therefore this may just be some n00bish mistake I'm overlooking.

======================================================================================
EDIT: Ok, I solved the problem, it was indeed a simple n00bish mistake.
I had simply forgot to route the form in my login_view properly. My old form_open linked to admin.php which handled the login process, but I only changed it to form_open('auth') instead of form_open('auth/login'). I figured I would leave this post here for any others that get stuck by anything similar.

[eluser]Zaher Ghaibeh[/eluser]
@digital_frog your problem is that your using the controller without making sure that the vars inside your view is really the same as the one you use in your controller ..

for example :
Code:
Message: Undefined variable: password
mean that you have a password variable in your view which is not defined inside your controller and if it is, you didnt pass it to your view ..

all of your problem are the same

[eluser]sirvoo[/eluser]
I've installed Ion Auth. I am able to register and log in but I don't receive any emails when I register or reset the password.

Do I need to set this anywhere?

I've create email.php in the config folder. I've tried
Code:
$config['protocol'] = 'mail';
and
Code:
$config['protocol']='smtp';

$config['smtp_host']='ssl://smtp.googlemail.com'; //(SMTP server)

$config['smtp_port']='465'; //(SMTP port)

$config['smtp_timeout']='30';

$config['smtp_user']='email'; //([email protected])

$config['smtp_pass']='password'; // (gmail password)


$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";

config/ion_auth.php
Code:
$config['use_ci_email'] = FALSE; // Send Email using the builtin CI email class, if false it will return the code and the identity
//$config['email_config'] = array(
// 'mailtype' => 'html',
//);
$config['email_config'] = 'email';

[eluser]adityamenon[/eluser]
[quote author="sirvoo" date="1341206144"]I've installed Ion Auth. I am able to register and log in but I don't receive any emails when I register or reset the password.

Do I need to set this anywhere?

I've create email.php in the config folder. I've tried
Code:
$config['protocol'] = 'mail';
and
Code:
$config['protocol']='smtp';

$config['smtp_host']='ssl://smtp.googlemail.com'; //(SMTP server)

$config['smtp_port']='465'; //(SMTP port)

$config['smtp_timeout']='30';

$config['smtp_user']='email'; //([email protected])

$config['smtp_pass']='password'; // (gmail password)


$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";

config/ion_auth.php
Code:
$config['use_ci_email'] = FALSE; // Send Email using the builtin CI email class, if false it will return the code and the identity
//$config['email_config'] = array(
// 'mailtype' => 'html',
//);
$config['email_config'] = 'email';
[/quote]

Did you make the changes to the settings as described in the comments within the code?

[eluser]sirvoo[/eluser]
[quote author="adityamenon" date="1341207878"]

Did you make the changes to the settings as described in the comments within the code?[/quote]

Are you referring to:
Code:
$config['smtp_user']='email'; //([email protected])

$config['smtp_pass']='password'; // (gmail password)

Yes I did input the correct details

[eluser]adityamenon[/eluser]
This is very probably an issue of the server unable to send emails, rather than CI or IAuth. A suggestion: replace with $config['use_ci_email'] = TRUE, and save a file called email.php inside application/config/ and autoload the email library within application/config/autoload.php

Then write a little file to test the CI email functionality. Use $this->email->print_debugger(); to know what's going wrong...

If nothing is going wrong, the next time you try to register the emails should go out properly.

[eluser]digital_frog[/eluser]
I'm trying to create a function that displays data that the currently logged in user has in a table separate from the ion_auth users. The table has three columns:[id (the primary key)], [uid (which matches the users id)], and [items (what the user currently has)]. The problem is that I can't seem to get at the current user's id.

How can I get the user's id from ion_auth?
I tried using
Code:
$user = $this->ion_auth->get_user();
from the start of this thread but this is throwing errors.
I've also tried using $user_id = $this->session->userdata( 'id' );
to try to get the data from the session, but that has only returned zero.

[eluser]digital_frog[/eluser]
[quote author="digital_frog" date="1341600553"]I'm trying to create a function that displays data that the currently logged in user has in a table separate from the ion_auth users. The table has three columns:[id (the primary key)], [uid (which matches the users id)], and [items (what the user currently has)]. The problem is that I can't seem to get at the current user's id.

How can I get the user's id from ion_auth?
I tried using
Code:
$user = $this->ion_auth->get_user();
from the start of this thread but this is throwing errors.
I've also tried using $user_id = $this->session->userdata( 'id' );
to try to get the data from the session, but that has only returned zero.
[/quote]

Funny how working for however long on a problem does so little, yet five minutes after asking the answer is discovered. Here is the solution:

$user = $this->ion_auth->user()->row();
$user_id = $user->id;

[eluser]adityamenon[/eluser]
[quote author="digital_frog" date="1341602023"]

Funny how working for however long on a problem does so little, yet five minutes after asking the answer is discovered. Here is the solution:

$user = $this->ion_auth->user()->row();
$user_id = $user->id;[/quote]

Haha yes, ion_auth autoloads classes from the model when it receives requests for classes that do not exist in the library. So you need to assume the returned data will be in a CodeIgniter database object. Also, I'm not trying to flame you, but always read the Ionauth user guide + search the issue queues + this forum thread with google any time you see a sticky problem, instead of trying to solve it for hours. Chances are someone has already faced it and that will save you a lot of time Smile This is really not so obvious (even for me the advise troll) and people always tend to try and solve it for themselves!




Theme © iAndrew 2016 - Forum software by © MyBB