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

[eluser]Ben Edmunds[/eluser]
Hey Sinclair,

The create_user() method in the example code is just an example. Feel free to use the register_user() method of the library in whatever way you need.
#42

[eluser]Sinclair[/eluser]
Thanks for the reply.

I will use the Ion Auth for the project. Thanks a lot!

I will use postgreSQL database, here is the model for test purposes.

Code:
CREATE TABLE "users" (
    "id" SERIAL NOT NULL,
    "group_id" int4 NOT NULL,
    "ip_address" char(16) NOT NULL,
    "username" varchar(15) NOT NULL,
    "password" varchar(40) NOT NULL,
    "email" varchar(40) NOT NULL,
    "activation_code" varchar(40),
    "forgotten_password_code" varchar(40),
    "active" int4,
  PRIMARY KEY("id"),
  CONSTRAINT "check_id" CHECK(id >= 0),
  CONSTRAINT "check_group_id" CHECK(group_id >= 0),
  CONSTRAINT "check_active" CHECK(active >= 0)
);


CREATE TABLE "meta" (
    "id" SERIAL NOT NULL,
    "user_id" int4,
    "first_name" varchar(50),
    "last_name" varchar(50),
    "company" varchar(100),
    "phone" varchar(20),
  PRIMARY KEY("id"),
  CONSTRAINT "check_id" CHECK(id >= 0),
  CONSTRAINT "check_user_id" CHECK(user_id >= 0)
);


CREATE TABLE "groups" (
    "id" SERIAL NOT NULL,
    "name" varchar(20) NOT NULL,
    "description" varchar(100) NOT NULL,
  PRIMARY KEY("id"),
  CONSTRAINT "check_id" CHECK(id >= 0)
);


INSERT INTO groups (id, name, description) VALUES
    (1,'admin','Administrator'),
    (2,'members','General User');
    
INSERT INTO meta (id, user_id, first_name, last_name, company, phone) VALUES
    ('1','1','Admin','istrator','ADMIN','0');
    
INSERT INTO users (id, group_id, ip_address, username, password, email, activation_code, forgotten_password_code, active) VALUES
    ('1','1','127.0.0.1','administrator','59beecdf7fc966e2f17fd8f65a4a9aeb09d4a3d4','[email protected]','',NULL,'1');

In the project I will not use postgreSQL sequences(same as auto increment of MySQL). I will use triggers instead.

Here to share.


Best Regards,
#43

[eluser]Ben Edmunds[/eluser]
joytopia,

Thank you for finding the error and the fix. I just pushed the changes to git.


Thanks!
#44

[eluser]Ben Edmunds[/eluser]
Sinclair,

Github's being stupid right now but as soon as it's back up I'll push your file.


Thanks for the file!
#45

[eluser]darrenfauth[/eluser]
Ben-

I'm finding your Ion Auth to be a great starting point for my project that handles memberships on a site. Thanks for your work...I agree that keeping it lightweight and generic is good.

Joytopia-

Would you mind sharing your create_user method and view? I'm not missing something here, right? The model has the logic to handle it, but there is not currently a method in the controller.

Thanks!
#46

[eluser]Ben Edmunds[/eluser]
Darren,

Thanks man!

The github repo is now updated with Joytopia's fix.


The method to use to create a user is $this->ion_auth->register(). There is an example of using it in the controller's create_user() method.
#47

[eluser]darrenfauth[/eluser]
ahhh....sorry. I meant the update_user function. I'm thinking that is a function that lets you (or the user) update their own (meta) information.
#48

[eluser]Ben Edmunds[/eluser]
Darren,

It's the update_user() method of the library, so $this->ion_auth->update_user($id, $data) and $data is an array of the fields to update.
#49

[eluser]darrenfauth[/eluser]
Gotcha Ben...thanks.
#50

[eluser]Ben Edmunds[/eluser]
All,

I just pushed the "remember me" functionality to github.


Please abuse it like a crazed maniac and let me know of any errors you find.


http://github.com/benedmunds/CodeIgniter-Ion-Auth


Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB