Merge branch 'branch-3' of bitbucket.org:venbaittech/bbone into branch-3
This commit is contained in:
commit
cb1287ce35
@ -50,63 +50,25 @@ public function index()
|
||||
|
||||
public function authendicate()
|
||||
{
|
||||
$user = $this->auth_model->validate_user();
|
||||
$business = $this->auth_model->validateBusiness($user->business_id);
|
||||
|
||||
if ($user->business_id !== '0' && empty($business)) {
|
||||
$this->session->set_flashdata('msg', "Business Deactivated Contact Administrator");
|
||||
redirect('login');
|
||||
}
|
||||
$user = $this->auth_model->validate_user();
|
||||
|
||||
if($user){
|
||||
|
||||
//check if user avaiable or not
|
||||
if (empty($user)) {
|
||||
$this->session->set_flashdata('msg', "username not avaiable");
|
||||
$this->session->set_flashdata('msg', "user not avaiable");
|
||||
redirect('login');
|
||||
}
|
||||
//check if user Deactivated by admin or not
|
||||
if (!empty($user) && $user->is_active == 0) {
|
||||
$this->session->set_flashdata('msg', "deactivate user");
|
||||
redirect('login');
|
||||
}
|
||||
// if (!empty($user)) {
|
||||
// if ($user->is_active == 0) {
|
||||
// $this->session->set_flashdata('msg', $user);
|
||||
// redirect('login');
|
||||
// }
|
||||
// else{
|
||||
// $this->session->set_flashdata('msg', $user);
|
||||
// redirect('login');
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// if (!empty($user) && $user->status == 0) {
|
||||
// // account pending
|
||||
// echo json_encode(array('st'=>2));
|
||||
// exit();
|
||||
// }
|
||||
// if (!empty($user) && $user->status == 2) {
|
||||
// // account suspend
|
||||
// echo json_encode(array('st'=>3));
|
||||
// exit();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// if ($user->role == 'user') {
|
||||
// $diff = date_difference($user->created_at);
|
||||
// if (!empty($user) && $user->email_verified == 0 && $this->settings->enable_email_verify == 1 && $diff < 2) {
|
||||
// // email verify
|
||||
// echo json_encode(array('st'=>4));
|
||||
// exit();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// if ($user->role == 'subadmin' || $user->role == 'editor' || $user->role == 'viewer') {
|
||||
// $user_id = $user->parent_id;
|
||||
// }else{
|
||||
// $user_id = $user->id;
|
||||
// }
|
||||
|
||||
// if valid
|
||||
//check the password of the user is correct or not
|
||||
if(password_verify($this->input->post('password'), $user->password))
|
||||
{
|
||||
$data = array(
|
||||
@ -126,6 +88,22 @@ public function authendicate()
|
||||
// pass the value 1 when the username or password is wrong
|
||||
$this->session->set_flashdata('msg',"password doesn't match");
|
||||
redirect('login');
|
||||
|
||||
//check the business is active or deactive
|
||||
if($user->role !== 'sadmin'){
|
||||
$business = $this->auth_model->validateBusiness($user->business_id);
|
||||
if ($user->business_id !== '0' && empty($business) && $business !== NULL) {
|
||||
$this->session->set_flashdata('msg', "Business not avaiable Contact Administrator");
|
||||
redirect('login');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
$this->session->set_flashdata('msg', "user not avaiable");
|
||||
redirect('login');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function logout()
|
||||
@ -264,4 +242,14 @@ public function change_password()
|
||||
$userData = $this->MY_Model->edit_option($data, $id, $table);
|
||||
redirect('login');
|
||||
}
|
||||
|
||||
public function is_superadmin_check()
|
||||
{
|
||||
|
||||
if (user()->role == 'sadmin') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user