change pass:suseendhiran
This commit is contained in:
parent
915afbe6de
commit
286cb386da
@ -56,11 +56,12 @@ $routes->match(['post'],'/user_edit','Admin_controller::user_edit');
|
|||||||
$routes->match(['get','post'],'/user_add','Admin_controller::user_add');
|
$routes->match(['get','post'],'/user_add','Admin_controller::user_add');
|
||||||
$routes->match(['get'],'/admin_profile/(:any)','Admin_controller::admin_profile/$1');
|
$routes->match(['get'],'/admin_profile/(:any)','Admin_controller::admin_profile/$1');
|
||||||
$routes->match(['post'],'/admin_profile','Admin_controller::admin_profile');
|
$routes->match(['post'],'/admin_profile','Admin_controller::admin_profile');
|
||||||
$routes->match(['post'],'/profilepic','Admin_controller::profilepic_insert');
|
$routes->match(['post'],'/profilepic_insert','Admin_controller::profilepic_insert');
|
||||||
$routes->match(['get'],'/credits_pack_list','Admin_controller::credits_pack_list');
|
$routes->match(['get'],'/credits_pack_list','Admin_controller::credits_pack_list');
|
||||||
$routes->match(['get'],'/credits_pack_edit/(:any)','Admin_controller::credits_pack_edit/$1');
|
$routes->match(['get'],'/credits_pack_edit/(:any)','Admin_controller::credits_pack_edit/$1');
|
||||||
$routes->match(['post'],'/credits_pack_edit','Admin_controller::credits_pack_edit');
|
$routes->match(['post'],'/credits_pack_edit','Admin_controller::credits_pack_edit');
|
||||||
$routes->match(['get','post'],'/credits_pack_add','Admin_controller::credits_pack_add');
|
$routes->match(['get','post'],'/credits_pack_add','Admin_controller::credits_pack_add');
|
||||||
|
$routes->match(['get','post'],'/user_password_change','Admin_controller::user_password_change');
|
||||||
|
|
||||||
$routes->match(['get'],'/admin_home','Dashboard::admin_home');
|
$routes->match(['get'],'/admin_home','Dashboard::admin_home');
|
||||||
$routes->match(['get'],'/member_home','Dashboard::member_home');
|
$routes->match(['get'],'/member_home','Dashboard::member_home');
|
||||||
|
|||||||
@ -157,25 +157,30 @@ class Admin_controller extends BaseController
|
|||||||
|
|
||||||
public function profilepic_insert()
|
public function profilepic_insert()
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->request->getmethod() == 'post')
|
if($this->request->getmethod() == 'post')
|
||||||
{
|
{
|
||||||
if(isset($_FILES["image_file"]["name"]))
|
$path = ROOTPATH ."/public/assets/images/users";
|
||||||
|
if($this->request->getFile('profile'))
|
||||||
{
|
{
|
||||||
$config['upload_path'] = base_url()."/public/assets/images/users";
|
$img = $this->request->getFile('profile');
|
||||||
$config['allowed_types'] = 'jpg|jpeg|png|gif';
|
if ($img->isValid() && ! $img->hasMoved())
|
||||||
print_r($config);die();
|
{
|
||||||
|
//$newName = $img->getRandomName();
|
||||||
$this->load->library('upload', $config);
|
$f_type=$_FILES['profile']['name'];
|
||||||
if(!$this->upload->do_upload('image_file'))
|
$data['profile'] = $f_type;
|
||||||
{
|
$this->UserModel->where('id', $this->request->getVar('id') )->set($data)->update();
|
||||||
echo $this->upload->display_errors();
|
$img->move($path, $f_type);
|
||||||
}
|
return redirect()->to(base_url()."admin_profile/".md5($this->request->getVar('id')));
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$data = $this->upload->data();
|
{
|
||||||
echo '<img src="'.base_url().'upload/'.$data["file_name"].'" width="300" height="225" class="img-thumbnail" />';
|
return redirect()->to(base_url()."admin_profile/".md5($this->request->getVar('id')));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return redirect()->to(base_url()."admin_profile/".md5($this->request->getVar('id')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +243,35 @@ class Admin_controller extends BaseController
|
|||||||
echo view('credits_pack_form');
|
echo view('credits_pack_form');
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user_password_change()
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->request->getmethod() == 'post')
|
||||||
|
{
|
||||||
|
//insert member details
|
||||||
|
$UserData = $this->request->getVar();
|
||||||
|
$old_password = $this->request->getVar('old_password');
|
||||||
|
$data = $this->UserModel->where('id', $this->request->getVar('id') )->find();
|
||||||
|
if (password_verify($old_password ,$data[0]['password']))
|
||||||
|
{
|
||||||
|
$this->UserModel->where('id', $this->request->getVar('id') )->set($UserData)->update();
|
||||||
|
$this->session->setTempdata('mail_success',"Password changed successfully",3);
|
||||||
|
return redirect()->to(base_url()."admin");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->session->setTempdata('error',"Entered wrong old password",3);
|
||||||
|
return redirect()->to(base_url()."user_password_change");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$userdata['userdata']=$this->dModel->getLoggedInUserData(session()->get('logged_user'));
|
||||||
|
echo view('layout/header',$userdata);
|
||||||
|
echo view('users_password');
|
||||||
|
echo view('layout/footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,11 @@
|
|||||||
<form method="post" action="<?= base_url()."admin"; ?>">
|
<form method="post" action="<?= base_url()."admin"; ?>">
|
||||||
|
|
||||||
|
|
||||||
|
<?php if(session()->getTempdata('mail_success')):?>
|
||||||
|
<div class="alert alert-success" >
|
||||||
|
<?= session()->getTempdata('mail_success'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif;?>
|
||||||
<?php if(session()->getTempdata('error')):?>
|
<?php if(session()->getTempdata('error')):?>
|
||||||
<div class="alert alert-danger" >
|
<div class="alert alert-danger" >
|
||||||
<?= session()->getTempdata('error'); ?>
|
<?= session()->getTempdata('error'); ?>
|
||||||
|
|||||||
@ -304,8 +304,8 @@ $(document).ready(function(){
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- item-->
|
<!-- item-->
|
||||||
<a href="<?= base_url()."admin_profile/". md5($userdata->id); ?>" class="dropdown-item notify-item">
|
<a href="<?= base_url()."user_password_change/" ?>" class="dropdown-item notify-item">
|
||||||
<i class="ri-account-circle-line"></i>
|
<i class="mdi mdi-lock-outline"></i>
|
||||||
<span>Change Password</span>
|
<span>Change Password</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@ -73,9 +73,10 @@ body {
|
|||||||
<div class="col-lg-12 col-xl-12">
|
<div class="col-lg-12 col-xl-12">
|
||||||
<div class="card text-center">
|
<div class="card text-center">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post" action="" enctype="multipart/form-data">
|
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?= base_url()."profilepic_insert"; ?>" enctype="multipart/form-data">
|
||||||
<input id="id" name="id" value="<?= $userList[0]['id'] ?>" type="hidden" />
|
<input id="id" name="id" value="<?= $userList[0]['id'] ?>" type="hidden" />
|
||||||
<?php if ($userList[0]['profile'] == NULL) { ?>
|
<button type="submit" class="btn btn-success" hidden>Update</button>
|
||||||
|
<?php if ($userList[0]['profile'] == '') { ?>
|
||||||
<div class="profilepic">
|
<div class="profilepic">
|
||||||
<!-- <img style="width: 100%;height: 100%; display: block;" src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="Avatar" title="Change the avatar"> -->
|
<!-- <img style="width: 100%;height: 100%; display: block;" src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="Avatar" title="Change the avatar"> -->
|
||||||
<img src='<?php echo base_url()."/public/assets/images/users/avatar-1.jpg" ?>' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
|
<img src='<?php echo base_url()."/public/assets/images/users/avatar-1.jpg" ?>' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
|
||||||
@ -89,7 +90,7 @@ body {
|
|||||||
else { ?>
|
else { ?>
|
||||||
<div class="profilepic">
|
<div class="profilepic">
|
||||||
<!-- <img style="width: 100%;height: 100%; display: block;" src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="Avatar" title="Change the avatar"> -->
|
<!-- <img style="width: 100%;height: 100%; display: block;" src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg" alt="Avatar" title="Change the avatar"> -->
|
||||||
<img src='<?php echo base_url()?>"/public/assets/images/users/<?php echo $userList[0]['profile'] ?>' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
|
<img src='<?php echo base_url()."/public/assets/images/users/"?><?php echo $userList[0]['profile'] ?>' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
|
||||||
<input id="file_profile" name="profile" class="typeFile1" type="file" hidden/>
|
<input id="file_profile" name="profile" class="typeFile1" type="file" hidden/>
|
||||||
<div class="profilepic__content">
|
<div class="profilepic__content">
|
||||||
<span class="profilepic__icon"><i class="fa fa-camera" style="font-size:25px;color:black"></i></span>
|
<span class="profilepic__icon"><i class="fa fa-camera" style="font-size:25px;color:black"></i></span>
|
||||||
@ -137,27 +138,25 @@ $(".profilepic").one('click',function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// change login person profile pic => file name : user/profile.php
|
// change login person profile pic => file name : user/profile.php
|
||||||
$(document).ready(function(){
|
|
||||||
$("#file_profile").change(function(){
|
$("#file_profile").change(function(){
|
||||||
$(".btn-success").click();
|
$(".btn-success").click();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('change','#file_profile',function(e){
|
// $(document).on('change','#file_profile',function(e){
|
||||||
var data = $("#form").serialize();
|
// var data = $("#form").serialize();
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
type: "post",
|
// type: "post",
|
||||||
url: "<?php echo base_url();?>profilepic",
|
// url: "<?php echo base_url();?>profilepic_insert",
|
||||||
data: data,
|
// data: data,
|
||||||
json: true,
|
// json: true,
|
||||||
success: function(response) {
|
// success: function(response) {
|
||||||
alert(response)
|
// alert(response)
|
||||||
if (response == true) {
|
// if (response == true) {
|
||||||
alert("dakug");
|
// alert("dakug");
|
||||||
}
|
// }
|
||||||
|
|
||||||
},
|
// },
|
||||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
// error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
</script>
|
</script>
|
||||||
@ -148,7 +148,7 @@
|
|||||||
<?php if(isset($userList)){ ?> Update <?php } else { ?> Save <?php } ?>
|
<?php if(isset($userList)){ ?> Update <?php } else { ?> Save <?php } ?>
|
||||||
</button>
|
</button>
|
||||||
<button type="reset"
|
<button type="reset"
|
||||||
class="btn btn-secondary waves-effect">
|
class="btn btn-secondary waves-effect" onclick="history.back()">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -0,0 +1,73 @@
|
|||||||
|
<div class="account-pages mt-5 mb-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="header-title" style="text-align: center;">Change Password</h3>
|
||||||
|
<p class="sub-header">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<form method="post" action="<?= base_url()."user_password_change"; ?>" role="form" class="parsley-examples">
|
||||||
|
<input id="id" type="hidden" value="<?= $userdata->id; ?>" name="id">
|
||||||
|
|
||||||
|
<?php if(session()->getTempdata('mail_success')):?>
|
||||||
|
<div class="alert alert-success" >
|
||||||
|
<?= session()->getTempdata('mail_success'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif;?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if(session()->getTempdata('error')):?>
|
||||||
|
<div class="alert alert-danger" >
|
||||||
|
<?= session()->getTempdata('error'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif;?>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="hori-pass1" class="col-4 col-form-label">Old Password<span class="text-danger">*</span></label>
|
||||||
|
<div class="col-7">
|
||||||
|
<input id="hori-pass" type="password" placeholder="Password" required
|
||||||
|
class="form-control" name="old_password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="hori-pass1" class="col-4 col-form-label">Password<span class="text-danger">*</span></label>
|
||||||
|
<div class="col-7">
|
||||||
|
<input id="hori-pass1" type="password" placeholder="Password" required
|
||||||
|
class="form-control" name="password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="hori-pass2" class="col-4 col-form-label">Confirm Password
|
||||||
|
<span class="text-danger">*</span></label>
|
||||||
|
<div class="col-7">
|
||||||
|
<input data-parsley-equalto="#hori-pass1" type="password" required
|
||||||
|
placeholder="Password" class="form-control" id="hori-pass2">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-8 offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
<button type="reset"
|
||||||
|
class="btn btn-secondary waves-effect">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end card-box -->
|
||||||
|
|
||||||
|
</div> <!-- end col -->
|
||||||
|
</div>
|
||||||
|
<!-- end row -->
|
||||||
|
</div>
|
||||||
|
<!-- end container -->
|
||||||
|
</div>
|
||||||
Loading…
Reference in New Issue
Block a user