Hello i tri tank auth with postgresql,
But i get this error
A Database Error Occurred
Error Number:
ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « user_data »
INSERT INTO "ci_sessions" ("session_id", "ip_address", "user_agent", "last_activity") VALUES ('fc40d7fc1a67d070866dc3578fdd1d1f', '81.247.128.65', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.', 1240510179)
the columns user_data is “`user_data` text COLLATE utf8_bin NOT NULL,” normaly not null,
so i dont understand why the sql request contain no data for the field user_data.
CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(16) DEFAULT '0' NOT NULL, user_agent varchar(50) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text NOT NULL, PRIMARY KEY (session_id) );
CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(16) DEFAULT '0' NOT NULL, user_agent varchar(50) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text NOT NULL, PRIMARY KEY (session_id) );
When exactly this SQL error occur?
thanks for the reply
I trie to port tank auth to postgresql.
De probleme is, if i go to the page /auth/login/ . Apart of the script do this request
INSERT INTO "ci_sessions" ("session_id", "ip_address", "user_agent", "last_activity") VALUES ('fc40d7fc1a67d070866dc3578fdd1d1f', '81.247.128.65', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.', 1240510179)
as you can see there is only 4 fields in the sql request. But on the schema there are 5 field for test i have change the schema like this
CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(16) DEFAULT '0' NOT NULL, user_agent varchar(50) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text , PRIMARY KEY (session_id) );
that work but i dont know if that change afect the tank auth script???
If you want i can post the schema of the postgresql database.
I tried to google any info about this case, but found nothing.
It seems to me that the problem is in PostgreSQL driver for CodeIgniter, in session management. Unfortunately I can’t prove it—there is no PostgreSQL on my hoster’s server.
Would you test how sessions work on PostgreSQL in your aplication regardless of Tank Auth? Does any similar error occur?
I tried to google any info about this case, but found nothing.
It seems to me that the problem is in PostgreSQL driver for CodeIgniter, in session management. Unfortunately I can’t prove it—there is no PostgreSQL on my hoster’s server.
Would you test how sessions work on PostgreSQL in your aplication regardless of Tank Auth? Does any similar error occur?
I think is very dificult to port to postgresql, because postgresql is realy different with mysql for exemple no unix time function in postgresql.
For testing i have install mysql to see the demo of tank auth.
I can create a account.
I recive de mail for validation.
I can validate de account.
I can login without capcha.
I can logout
I can login with capcha
include thank auth to my aplication?
I try like this, tell my if it is correct?
function index() { if ($this->tank_auth->is_logged_in()) { $this->load->view('welcome_message'); } else { redirect('/auth/login/'); } } }
It is possible to manage users role with tank auth ???
If it is not possible, can you tell my the way to extend the thank auth with role and or profile for users?
function index() { if ($this->tank_auth->is_logged_in()) { $this->load->view('welcome_message'); } else { redirect('/auth/login/'); } } }
It is possible to manage users role with tank auth ???
If it is not possible, can you tell my the way to extend the thank auth with role and or profile for users?
Yes, it’s correct. Also you can use get_username (or get_user_id) method to identify user when he/she is logged in.
Role management isn’t supported in this version. I think that role management shouldn’t be a part of authorisation library. Maybe there will be an extension for the lib, to manage user rights, give them access to different pages and moderate their profiles… But definitely it is not a direction in which I’m going to develop the library right now. I’d better add OpenId support to extend login options.
What about user profiles—they are supported already. To add new fields to user profile you have to:
- add corresponding fields to user_profiles table in database
- create a page for editing this data by registered user.
This edit page is supposed to be added in next version of the library.
Why don’t you change the controller code according to your needs?
When I was developing the library I supposed that ‘auth’ controller is a part that will be modified from one project to another. It is just a sample; many libraries are being distributed without such controller at all. So if its behavior doesn’t safisfy you then you’re free to change it. For example, if you don’t want user to be redirected to server root after successful login, just change this redirect in ‘login’ method to something else.
While correcting controller behavior is easy, changing names of controller’s methods may be a little bit complicated. If you want to change the name of ‘login’ method, don’t forget to correct it in all redirects to login (or at least to change this code to something else). Renaming other methods (such as ‘activate’ or ‘reset_password’) requires you to fix corresponding email templates also.
And renaming controller leads to fixing names in all view-files and redirects. Or you may use CI routing.
I don’t know is it possible to resolve this problem without touching the controller at all, using some tricks like remap functions or Redirect commands in htaccess-file. As for me, the best way is to change the code than to build struts.
There are no new features in this version, only minor bug fixes. The database structure is not affected, all the changes were in the code, in the folders ‘libraries’, ‘models’ and ‘views’.