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

[eluser]mautone[/eluser]
Hi.

I have a problem when i'm trying to create a user.
I'm doing it locally.

I already have a user in my db with the email [email protected]. I then try to create a new one with an email like this something [email protected].
It returns an error saying that there is already a user with that email address
Code:
//Create rules for the form
  $this->form_validation->set_rules(config_item('input_register_username'), 'Brugernavn', 'required');
  $this->form_validation->set_rules(config_item('input_register_email'), 'Email', 'required|valid_email');
  $this->form_validation->set_rules(config_item('input_register_password'), 'Adgangskode', 'required');
  $this->form_validation->set_rules(config_item('input_register_repeat_password'), 'Gentag adgangskode', 'required|matches[' . config_item('input_register_password') . ']');
  
  //Check if the validation returns true
  if($this->form_validation->run() === TRUE){
  
   //Convert to varialbles
   $email = $this->input->post(config_item('input_register_email'));
   $username = $this->input->post(config_item('input_register_username'));
   $password = $this->input->post(config_item('input_register_password'));
  
   //Check if email is available
   if($this->flexi_auth->email_available($email) === FALSE){
    
    //Check if username is available
    if($this->flexi_auth->username_available($username) === FALSE){
    
     //Check if the user is created
     if($this->flexi_auth->insert_user($email, $username, $password, '' , 1, TRUE)){
      //Create a message and send the user to the login form
      $this->session->set_flashdata('message', $this->flexi_auth->get_messages());
      redirect('admin/auth/login', 'refresh');
     } else {
      //Create a error and send the user back to the form
      $this->session->set_flashdata('error', $this->flexi_auth->get_messages());
      redirect('admin/auth/register', 'refresh');
     }

    } else {
     //Username is already taken. Set error and send user back
     $this->session->set_flashdata('error', 'Brugernavn findes allerede. Vælg venligst et andet');
     redirect('admin/auth/register', 'refresh');
    }

   } else {
    //Email is already taken. Set error and send user back
    $this->session->set_flashdata('error', 'En bruger anvender allerede denne emailadresse. Vælg venligst en anden');
    redirect('admin/auth/register', 'refresh');
   }
  
  
  }
  
  render_view(lang('login_register_title'), 'register', $this->data['view'], TRUE);
}

Can somebody tell me where i can make it possible so the domain of the email address can be the same but not the whole email address?

[eluser]jatin.soni[/eluser]
This is one of the great library I found in the CodeIgniter authentication system. Thanks a lot

Just wonder if there is a way to implement in Module system with HMVC?

[eluser]Unknown[/eluser]
Hey, using Flexi Auth, which is great! Are there any functions to determine whether or not a user is currently active? I can check there online status by creating another column in the database, and when they login update this column, likewise when they logout, but when a user exists the browser, it still seems as if they are online, as they have not logged out?

Help is much appreciated, cheers!

[eluser]Unknown[/eluser]
Hello, I'm trying to use Flexi Auth in my project and I just faced the following problem: when I'm running code
Code:
function __construct() {
      parent::__construct();
      $this->auth = new stdClass;
    $this->load->library('flexi_auth');
                $this->load->model('flexi_auth_model');
    }

public function index(){
     $is=$this->flexi_auth->is_privileged('dashboard');
     echo $this->db->last_query();
}

$is is always false, but

Code:
$gg=$this->flexi_auth->get_user_privileges()->result();
print_r($gg);

shows

Code:
Array
(
    [0] => stdClass Object
        (
            [upriv_id] => 1
            [upriv_name] => dashboard
            [upriv_desc] => Dashboard access
            [upriv_users_id] => 1
            [upriv_users_uacc_fk] => 1
            [upriv_users_upriv_fk] => 1
        )

    [1] => stdClass Object
        (
            [upriv_id] => 2
            [upriv_name] => dsfsdf
            [upriv_desc] => Dsfsdf access
            [upriv_users_id] => 2
            [upriv_users_uacc_fk] => 1
            [upriv_users_upriv_fk] => 2
        )

)

Where am i wrong at using is_privileged?

[eluser]haseydesign[/eluser]
@janesjoplin

I would hazard a guess that there is some problem with your Codeigniter session setup.

The function get_user_privileges() is getting data from the database, and it is indicating that yes, the logged in user should have permission.
However the is_privileged() function is checking the logged in users current session data, if the privilege isn't defined within their session, then that will be your problem.

Once your user has logged in, try returning the session data to see what their credentials are.
Code:
echo '<pre>';
print_r($this->session->userdata['flexi_auth']);
echo '</pre>';

Array
(
    [user_identifier] => [email protected]
    [user_id] => 1
    [admin] => 1
    [group] => Array
        (
            [3] => Master
        )

    [privileges] => Array
        (
            [1] => dashboard
        )

    [logged_in_via_password] => 1
    [login_session_token] => b4562131fb41629a287ecd99750c40838c99e416
)

[eluser]Unknown[/eluser]
Hi everybody

Starting to work with Flex Auth. I'm interesting in how db indexes are placed.

Table 'user_groups'
- why to use 2 indexes, both on 'ugrp_id'

Table 'user_login_sessions'
- the same situation, but index is placed on varchar column

Table 'user_privilege_groups'
- indexes are placed on all columns.

I'm using clear, just downloaded version of Flex Auth.

[eluser]ash0803[/eluser]
Hi

I have got everything working with CI 2.1.4 fine EXCEPT the Remember ME function. I have tested with a brand new install of CI and using the demo files. I am testing by using the session expiry time in the flexiauth config and setting it to 5 or something like that.

Whenever this expires my session does as well and I am required to login again regardless of whether I used the remember checkbox.

Any suggestions?

Regards

Ash

[eluser]Unknown[/eluser]
default install, demo data...

if you do anything with the user account table it bombs


Message: Undefined index: upro_first_name
Filename: controllers/auth_lite.php
Line Number: 77
A PHP Error was encountered
Severity: Notice
Message: Undefined index: upro_last_name
Filename: controllers/auth_lite.php
Line Number: 77
A PHP Error was encountered
Severity: Notice
Message: Undefined index: upro_phone
Filename: controllers/auth_lite.php
Line Number: 78

seems its not left joining the demo_user_profiles somehow...


also

http://domain/auth_admin/manage_user_accounts


A Database Error Occurred

Error Number: 1054

Unknown column 'upro_first_name' in 'field list'

SELECT `uacc_id`, `uacc_email`, `uacc_suspend`, `ugrp_name`, `upro_first_name`, `upro_last_name` FROM (`user_accounts`) LEFT JOIN `user_groups` ON `user_accounts`.`uacc_group_fk` = `user_groups`.`ugrp_id` GROUP BY `user_accounts`.`uacc_id`

Filename: /domain/application/models/flexi_auth_lite_model.php

Line Number: 211

basically anything in regards to users is missing the upro_first_name etc since theres no left join of the user_profiles

[eluser]MrTomTom[/eluser]
Hi there,

I'm having some trouble with random logouts -- the system works absolutely fine with the exception that seemingly randomly the user will get logged out for no apparent reason. It's nor related to a specific amount of time or a specific page, so I'm having trouble nailing it down. Does anyone have any idea what it could be or how I could go about narrowing down what the issue could be?

Many thanks,

Tom

[eluser]Unknown[/eluser]
[quote author="MrTomTom" date="1391804172"]Hi there,

I'm having some trouble with random logouts -- the system works absolutely fine with the exception that seemingly randomly the user will get logged out for no apparent reason. It's nor related to a specific amount of time or a specific page, so I'm having trouble nailing it down. Does anyone have any idea what it could be or how I could go about narrowing down what the issue could be?

Many thanks,

Tom[/quote]

I have exactly the same problem: apparently random logouts




Theme © iAndrew 2016 - Forum software by © MyBB