otp verify:suseendhiran
This commit is contained in:
parent
bc9235fed2
commit
3c3092887b
@ -36,6 +36,12 @@ $routes->match(['get'],'/members_list','Member_controller::members_list');
|
||||
$routes->match(['get'],'/member_edit/(:any)','Member_controller::member_edit/$1');
|
||||
$routes->match(['post'],'/member_edit','Member_controller::member_edit');
|
||||
$routes->match(['get','post'],'/member_add','Member_controller::member_add');
|
||||
$routes->match(['get','post'],'/set_password/(:any)','Member_controller::set_password/$1');
|
||||
$routes->match(['get','post'],'/update_password','Member_controller::update_password');
|
||||
$routes->match(['get','post'],'/change_password','Member_controller::change_password');
|
||||
$routes->match(['get','post'],'/change_password_form','Member_controller::change_password_form');
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->match(['get','post'],'/admin','Admin_controller::index');
|
||||
@ -46,6 +52,7 @@ $routes->match(['post'],'/user_edit','Admin_controller::user_edit');
|
||||
$routes->match(['get','post'],'/user_add','Admin_controller::user_add');
|
||||
$routes->match(['get'],'/admin_profile/(:any)','Admin_controller::admin_profile/$1');
|
||||
$routes->match(['post'],'/admin_profile','Admin_controller::admin_profile');
|
||||
$routes->match(['post'],'/profilepic','Admin_controller::profilepic_insert');
|
||||
|
||||
$routes->match(['get'],'/admin_home','Dashboard::admin_home');
|
||||
$routes->match(['get'],'/member_home','Dashboard::member_home');
|
||||
@ -54,9 +61,13 @@ $routes->match(['get'],'/member_home','Dashboard::member_home');
|
||||
$routes->match(['get'],'fetch_country','Common_controller::fetch_country');
|
||||
$routes->match(['get','post'],'fetch_state','Common_controller::fetch_state');
|
||||
$routes->match(['get','post'],'fetch_city','Common_controller::fetch_city');
|
||||
$routes->match(['get','post'],'/check_if_mail_exists','Common_controller::check_if_mail_exists');
|
||||
|
||||
|
||||
$routes->match(['get','post'],'/mail/(:any)','Sendmail_controller::index/$1');
|
||||
$routes->match(['get','post'],'/verify_email/(:any)','Sendmail_controller::verify_email/$1');
|
||||
$routes->match(['get','post'],'/forgot_password','Sendmail_controller::forgot_password');
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
|
||||
@ -9,12 +9,11 @@ class Admin_controller extends BaseController
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->UserModel = new User_model();
|
||||
$this->dModel = new Dashboard_model();
|
||||
$this->cModel = new Common_model();
|
||||
helper(['form']);
|
||||
helper(['form', 'url']);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
@ -154,11 +153,57 @@ class Admin_controller extends BaseController
|
||||
->where('md5(users.id)', $user_id )
|
||||
->find();
|
||||
|
||||
print_r($data);die();
|
||||
// print_r($data);die();
|
||||
echo view('layout/header',$userdata);
|
||||
echo view('user_form',$data);
|
||||
echo view('profile',$data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
public function profilepic_insert()
|
||||
{
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
$action = $this->request->getVar();
|
||||
// print_r($action);die();
|
||||
$id = $this->request->getVar('id');
|
||||
//file upload confic
|
||||
$user_image['upload_path'] = base_url().'public/assets/images/users/';
|
||||
$user_image['allowed_types'] = 'jpg|png|jpeg';
|
||||
$user_image['max_size'] = 80000;
|
||||
//upload
|
||||
print_r($this->request->getFile('profile'));die();
|
||||
// $this->load->library('upload', $user_image);
|
||||
// $this->upload->initialize($user_image);
|
||||
if ($this->request->getPost('profile'))
|
||||
{
|
||||
$uploadPath = base_url().'public/assets/images/users/';
|
||||
$fileName = $this->request->getPost('profile')->move($uploadPath);
|
||||
if ($fileName)
|
||||
{
|
||||
// Store the file name into the database
|
||||
$data = [
|
||||
'filename' => $fileName
|
||||
];
|
||||
echo $fileName;
|
||||
// Do whatever you need with the data
|
||||
}
|
||||
// $error = array('error' => $this->upload->display_errors());
|
||||
// print_r($error);die();
|
||||
// echo false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $upload_user_image = $this->upload->data();
|
||||
// $action['profile'] = $upload_user_image['file_name'];
|
||||
// $userData = $this->UserModel->where('id', $id )->set($action)->update();
|
||||
// echo true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// -----------------------------------------------
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Controllers;
|
||||
use App\Models\User_model;
|
||||
use App\Models\Dashboard_model;
|
||||
use App\Models\Common_model;
|
||||
use App\Models\Member_model;
|
||||
class Common_controller extends BaseController
|
||||
{
|
||||
public $session;
|
||||
@ -11,6 +12,7 @@ class Common_controller extends BaseController
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->MemberModel = new Member_model();
|
||||
$this->UserModel = new User_model();
|
||||
$this->dModel = new Dashboard_model();
|
||||
$this->cModel = new Common_model();
|
||||
@ -42,6 +44,25 @@ class Common_controller extends BaseController
|
||||
echo $this->cModel->fetch_city($this->request->getVar('state_id'));
|
||||
}
|
||||
}
|
||||
|
||||
function check_if_mail_exists()
|
||||
{
|
||||
if($this->request->getVar('table'))
|
||||
{
|
||||
if($this->request->getVar('table') == 'member')
|
||||
$data = $this->MemberModel->where('email', $this->request->getVar('email'))->find();
|
||||
else if($this->request->getVar('table') == 'users')
|
||||
$data = $this->UserModel->where('email', $this->request->getVar('email'))->find();
|
||||
if ($data)
|
||||
{
|
||||
echo true;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -174,6 +174,84 @@ class Member_controller extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function forgot_password()
|
||||
{
|
||||
if($this->request->getmethod() == 'get')
|
||||
{
|
||||
return view('forgot_password.php');
|
||||
}
|
||||
else if($this->request->getmethod() == 'post')
|
||||
{
|
||||
|
||||
$email = $this->request->getVar('email');
|
||||
$user_data = $this->MemberModel->where('email', $email)->find();
|
||||
if ($user_data)
|
||||
{
|
||||
$otp = rand(1000 , 9999 );
|
||||
// $sendmail_controller = new Sendmail_controller();
|
||||
$get_data = $Sendmail_controller->index($this->request->getVar('email') , $otp , 2 );
|
||||
$data['status'] = 'success';
|
||||
$data['otp'] = $otp;
|
||||
echo json_encode($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['status'] = 'failed';
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function change_password_form()
|
||||
{
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
$otp = $this->request->getVar('otp');
|
||||
$verify_otp = $this->request->getVar('verify_otp');
|
||||
if ($otp == $verify_otp)
|
||||
{
|
||||
$email = $this->request->getVar('email');
|
||||
$user_data = $this->MemberModel->where('email', $email)->find();
|
||||
$this->session->setTempdata('id',$user_data[0]['id'],3);
|
||||
$this->session->setTempdata('email',$user_data[0]['email'],3);
|
||||
$this->session->setTempdata('mail_success', "OTP verification sucessfully",3);
|
||||
return view('set_password.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->setTempdata('error', "You entered wrong OTP.Please retry",3);
|
||||
return view('forgot_password.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function set_password($id)
|
||||
{
|
||||
if($this->request->getmethod() == 'get')
|
||||
{
|
||||
$user_data = $this->MemberModel->where('md5(id)', $id)->find();
|
||||
$this->session->setTempdata('id',$user_data[0]['id'],3);
|
||||
$this->session->setTempdata('email',$user_data[0]['email'],3);
|
||||
$this->session->setTempdata('mail_success', "Email verification sucessfully",3);
|
||||
return view('set_password.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function update_password()
|
||||
{
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
$MemberData = $this->request->getVar();
|
||||
$member_id = $this->request->getVar('id');
|
||||
$this->MemberModel->where('id', $member_id )->set($MemberData)->update();
|
||||
$this->session->setTempdata('mail_success', "Password set sucessfully",3);
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------
|
||||
}
|
||||
|
||||
@ -14,15 +14,19 @@ class Sendmail_controller extends BaseController
|
||||
}
|
||||
public function index($to,$code,$return)
|
||||
{
|
||||
$email = \Config\Services::email();
|
||||
|
||||
$email = \Config\Services::email();
|
||||
$email->setFrom('suseendhiran.1702117@srit.org', 'suseendhiran');
|
||||
$email->setTo($to);
|
||||
// $email->setCC('another@another-example.com');
|
||||
// $email->setBCC('them@their-example.com');
|
||||
$message = '<p>Please click the following link to verify your email address</p>';
|
||||
$message .= '<p><a href="'.base_url().'verify_email/'.md5($code).'">Verify Email</a></p>';
|
||||
|
||||
$email->setTo($to);
|
||||
if ($return == 2)
|
||||
{
|
||||
$message = $code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<p>Please click the following link to verify your email address</p>';
|
||||
$message .= '<p><a href="'.base_url().'verify_email/'.md5($code).'">Verify Email</a></p>';
|
||||
}
|
||||
$email->setSubject('Verify your email address');
|
||||
$email->setMessage($message);
|
||||
if ($email->send())
|
||||
@ -31,15 +35,11 @@ class Sendmail_controller extends BaseController
|
||||
{
|
||||
$this->session->setTempdata('mail_success', "Please check your mail to verify",3);
|
||||
// return redirect()->to(base_url());
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
echo 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,8 +57,9 @@ class Sendmail_controller extends BaseController
|
||||
if($update_data)
|
||||
{
|
||||
// Show success message
|
||||
$this->session->setTempdata('mail_success', "Email verification sucessfully.",3);
|
||||
return redirect()->to(base_url());
|
||||
// $this->session->setTempdata('mail_success', "Email verification sucessfully.",3);
|
||||
// return redirect()->to(base_url());
|
||||
return redirect()->to(base_url()."set_password/".md5($user_data[0]['id']));
|
||||
|
||||
}
|
||||
else
|
||||
@ -74,5 +75,33 @@ class Sendmail_controller extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function forgot_password()
|
||||
{
|
||||
if($this->request->getmethod() == 'get')
|
||||
{
|
||||
return view('forgot_password.php');
|
||||
}
|
||||
else if($this->request->getmethod() == 'post')
|
||||
{
|
||||
|
||||
$email = $this->request->getVar('email');
|
||||
$user_data = $this->MemberModel->where('email', $email)->find();
|
||||
if ($user_data)
|
||||
{
|
||||
$otp = rand(1000 , 9999);
|
||||
$this->index($this->request->getVar('email') , $otp , 2 );
|
||||
$data['status'] = 'success';
|
||||
$data['otp'] = $otp;
|
||||
echo json_encode($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['status'] = 'failed';
|
||||
echo $data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -7,7 +7,7 @@ class User_model extends Model
|
||||
protected $table = 'users';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['role','name', 'mobile','email', 'password', 'address' , 'city' , 'state' , 'country' , 'pincode' ,'created_at','updated_at'];
|
||||
protected $allowedFields = ['role','name', 'mobile', 'profile' , 'email', 'password', 'address' , 'city' , 'state' , 'country' , 'pincode' ,'created_at','updated_at'];
|
||||
|
||||
protected $beforeInsert = ['beforeInsert'];
|
||||
protected $beforeUpdate = ['beforeUpdate'];
|
||||
|
||||
132
app/Views/forgot_password.php
Normal file
132
app/Views/forgot_password.php
Normal file
@ -0,0 +1,132 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Log In | Member</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="public/assets/images/favicon.ico">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="public/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="public/assets/css/app-material.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="public/assets/css/bootstrap-material-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="public/assets/css/app-material-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="public/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- jquery -->
|
||||
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> -->
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
|
||||
|
||||
<h1>Account recovery</h1>
|
||||
|
||||
|
||||
<!-- <p class="text-muted mb-4 mt-3">Enter your email address and password to access admin panel.</p> -->
|
||||
</div>
|
||||
</br>
|
||||
<form method="post" action="<?php echo base_url();?>change_password_form" method="post">
|
||||
<input type="hidden" id="verify_otp" name="verify_otp" value="">
|
||||
|
||||
|
||||
<?php if(session()->getTempdata('error')):?>
|
||||
<div class="alert alert-danger" id="alert">
|
||||
<?= session()->getTempdata('error'); ?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="emailaddress">Email address</label>
|
||||
<input class="form-control" type="email" name="email" id="email" required="" value="" placeholder="Enter your email">
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3 disable" id="disable">
|
||||
<label for="otp">OTP</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input type="text" id="otp" name="otp" value="" class="form-control" placeholder="Enter your otp">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</br>
|
||||
|
||||
<div class="form-group mb-0 text-center" id="re-sub">
|
||||
<button class="btn btn-primary btn-block" type="submit" id="submit"> Get OTP </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<script>document.write(new Date().getFullYear())</script> © theme by <a href="" class="text-dark">Venba</a>
|
||||
</footer>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="public/assets/js/vendor.min.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="public/assets/js/app.min.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
<script>
|
||||
// jQuery autohide element after 5 seconds
|
||||
$('#alert').delay(3000).fadeOut('slow');
|
||||
// This will disable just the div
|
||||
$(".disable").hide();
|
||||
|
||||
$(document).on('click','#submit',function(){
|
||||
alert("gaf")
|
||||
var email = $("#email").val();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url();?>forgot_password",
|
||||
data: { email : email },
|
||||
json: true,
|
||||
success: function(response) {
|
||||
response = jQuery.parseJSON(response);
|
||||
if (response.status == "success") {
|
||||
$(".disable").show();
|
||||
$('#verify_otp').val(response.otp);
|
||||
// $('#submit').html('Submit')
|
||||
$("#re-sub").html('<button class="btn btn-primary btn-block" type="submit"> Submit </button>');
|
||||
window.stop()
|
||||
}
|
||||
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
@ -79,6 +79,12 @@
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/js/app.min.js"></script>
|
||||
|
||||
<!-- Plugin js-->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/libs/parsleyjs/parsley.min.js"></script>
|
||||
|
||||
<!-- Validation init js-->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/js/pages/form-validation.init.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url()."/public"; ?>/assets/images/favicon.ico">
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="email" required parsley-type="email" class="form-control" name="email" value="<?php if(isset($Memberdata)){echo $Memberdata[0]['email'];} ?>" placeholder="Email">
|
||||
<input type="email" id="email" onchange="check_if_exists();" required parsley-type="email" class="form-control" name="email" value="<?php if(isset($Memberdata)){echo $Memberdata[0]['email'];} ?>" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(! isset($Memberdata)){ ?>
|
||||
<!-- <?php if(! isset($Memberdata)){ ?>
|
||||
<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">
|
||||
@ -67,7 +67,7 @@
|
||||
<input data-parsley-equalto="#hori-pass1" type="password" required placeholder="Password" class="form-control" id="hori-pass2">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?> -->
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
@ -131,5 +131,25 @@
|
||||
</div>
|
||||
<!-- end row-->
|
||||
|
||||
<script>
|
||||
function check_if_exists() {
|
||||
|
||||
var email = $("#email").val();
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<?php echo base_url(); ?>/check_if_mail_exists",
|
||||
data:{ email:email , table : 'member'},
|
||||
success:function(response)
|
||||
{
|
||||
if (response == true)
|
||||
{
|
||||
alert("This mail id already exists");
|
||||
$("#email").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<p> <a href="auth-recoverpw.html" class="text-muted ml-1">Forgot your password?</a></p>
|
||||
<p> <a href="<?= base_url()."forgot_password"; ?>" class="">Forgot your password?</a></p>
|
||||
<p class="text-muted">Don't have an account? <a href="<?= base_url()."register"; ?>" class="text-primary font-weight-medium ml-1">Sign Up</a></p>
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
|
||||
@ -78,6 +78,25 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function check_if_exists() {
|
||||
|
||||
var email = $("#email").val();
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<?php echo base_url(); ?>/check_if_mail_exists",
|
||||
data:{ email:email , table : 'member'},
|
||||
success:function(response)
|
||||
{
|
||||
if (response == true)
|
||||
{
|
||||
alert("This mail id already exists");
|
||||
$("#email").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@ -106,7 +125,7 @@ $(document).ready(function(){
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="email" required parsley-type="email" class="form-control"
|
||||
id="inputEmail3" placeholder="Email" name="email">
|
||||
id="email" placeholder="Email" onchange="check_if_exists();" name="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
@ -117,7 +136,7 @@ $(document).ready(function(){
|
||||
placeholder="Enter only numbers" name="mobile"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<!-- <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
|
||||
@ -131,7 +150,7 @@ $(document).ready(function(){
|
||||
<input data-parsley-equalto="#hori-pass1" type="password" required
|
||||
placeholder="Password" class="form-control" id="hori-pass2">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Address<span class="text-danger"></span></label>
|
||||
<div class="col-7">
|
||||
|
||||
152
app/Views/profile.php
Normal file
152
app/Views/profile.php
Normal file
@ -0,0 +1,152 @@
|
||||
<style>
|
||||
/* profile pic */
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.profilepic {
|
||||
position: relative;
|
||||
/* width: 125px;
|
||||
height: 125px; */
|
||||
/* border-radius: 50%; */
|
||||
overflow: hidden;
|
||||
background-color: #fffff7;
|
||||
}
|
||||
|
||||
.profilepic:hover .profilepic__content {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.profilepic:hover .profilepic__image {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.profilepic__image {
|
||||
object-fit: cover;
|
||||
opacity: 1;
|
||||
transition: opacity .2s ease-in-out;
|
||||
}
|
||||
|
||||
.profilepic__content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: black;
|
||||
opacity: 0;
|
||||
transition: opacity .2s ease-in-out;
|
||||
}
|
||||
|
||||
.profilepic__icon {
|
||||
color: white;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.fas {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.profilepic__text {
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</br></br>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-xl-12">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
|
||||
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post" action="" enctype="multipart/form-data">
|
||||
<input id="id" name="id" value="<?= $userList[0]['id'] ?>" type="hidden" />
|
||||
<?php if ($userList[0]['profile'] == NULL) { ?>
|
||||
<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 src='<?php echo base_url()."/public/assets/images/users/avatar-1.jpg" ?>' class="rounded-circle avatar-xl img-thumbnail" alt="profile-image">
|
||||
<input id="file_profile" name="profile" class="typeFile1" type="file" hidden/>
|
||||
<div class="profilepic__content">
|
||||
<span class="profilepic__icon"><i class="fa fa-camera" style="font-size:25px;color:black"></i></span>
|
||||
<span class="profilepic__text"><b>Edit Profile</b></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
else { ?>
|
||||
<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 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/>
|
||||
<div class="profilepic__content">
|
||||
<span class="profilepic__icon"><i class="fa fa-camera" style="font-size:25px;color:black"></i></span>
|
||||
<span class="profilepic__text"><b>Edit Profile</b></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<h4 class="mt-3 mb-0"><?= $userList[0]['name'] ?></h4>
|
||||
<div class="text-left mt-3">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Name :</th>
|
||||
<td class="text-muted"><?= $userList[0]['name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Mobile :</th>
|
||||
<td class="text-muted"><?= $userList[0]['mobile'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Email :</th>
|
||||
<td class="text-muted"><?= $userList[0]['email'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Location :</th>
|
||||
<td class="text-muted"><?= $userList[0]['address'] ?> , <?= $userList[0]['city_name'] ?> , <?= $userList[0]['state_name'] ?> , <?= $userList[0]['country_name'] ?> - <?= $userList[0]['pincode'] ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card-box -->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<script>
|
||||
// The handler is executed at most once per element per event type => one()
|
||||
$(".profilepic").one('click',function() {
|
||||
$("#file_profile").trigger("click");
|
||||
});
|
||||
|
||||
// change login person profile pic => file name : user/profile.php
|
||||
$(document).ready(function(){
|
||||
$("#file_profile").change(function(){
|
||||
$(".btn-success").click();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change','#file_profile',function(){
|
||||
var data = $("#form").serialize();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<?php echo base_url();?>profilepic",
|
||||
data: data,
|
||||
json: true,
|
||||
success: function(response) {
|
||||
alert(response)
|
||||
if (response == true) {
|
||||
alert("dakug");
|
||||
}
|
||||
|
||||
},
|
||||
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
127
app/Views/set_password.php
Normal file
127
app/Views/set_password.php
Normal file
@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Set Password</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url()."/public"; ?>/assets/images/favicon.ico">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url()."/public"; ?>/assets/css/bootstrap-corporate.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url()."/public"; ?>/assets/css/app-corporate.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url()."/public"; ?>/assets/css/bootstrap-corporate-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url()."/public"; ?>/assets/css/app-corporate-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url()."/public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
.text-danger {
|
||||
color: red !important;
|
||||
}
|
||||
.parsley-errors-list>li {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<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;">Set Password</h3>
|
||||
<p class="sub-header">
|
||||
</p>
|
||||
|
||||
<form method="post" action="<?= base_url()."update_password"; ?>" role="form" class="parsley-examples">
|
||||
<input id="id" type="hidden" value="<?= session()->getTempdata('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">Email<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="text" class="form-control" value="<?= session()->getTempdata('email'); ?>" readonly>
|
||||
</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>
|
||||
<!-- end page -->
|
||||
|
||||
<!-- Right bar overlay-->
|
||||
<div class="rightbar-overlay"></div>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/js/vendor.min.js"></script>
|
||||
|
||||
<!-- Plugin js-->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/libs/parsleyjs/parsley.min.js"></script>
|
||||
|
||||
<!-- Validation init js-->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/js/pages/form-validation.init.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url()."/public"; ?>/assets/js/app.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -38,6 +38,7 @@
|
||||
<option value="" >Select Role</option>
|
||||
<option value="Admin">Admin</option>
|
||||
<option value="Coach">Coach</option>
|
||||
<option value="Frontdesk">Frontdesk</option>
|
||||
</select>
|
||||
<!-- <input type="text" required class="form-control" name="role" value="<?php if(isset($userList)){echo $userList[0]['role'];} ?>" placeholder="Member Name"> -->
|
||||
</div>
|
||||
@ -53,7 +54,7 @@
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="email" required parsley-type="email" class="form-control" name="email" value="<?php if(isset($userList)){echo $userList[0]['email'];} ?>" placeholder="Email">
|
||||
<input type="email" id="email" onchange="check_if_exists();" required parsley-type="email" class="form-control" name="email" value="<?php if(isset($userList)){echo $userList[0]['email'];} ?>" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -65,7 +66,7 @@
|
||||
</div>
|
||||
|
||||
<?php if(! isset($userList)){ ?>
|
||||
<div class="form-group row">
|
||||
<!-- <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" name="password" placeholder="Password" required class="form-control">
|
||||
@ -77,7 +78,23 @@
|
||||
<div class="col-7">
|
||||
<input data-parsley-equalto="#hori-pass1" type="password" required placeholder="Password" class="form-control" id="hori-pass2">
|
||||
</div>
|
||||
</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>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -142,6 +159,27 @@
|
||||
<!-- end row-->
|
||||
|
||||
|
||||
<script>
|
||||
function check_if_exists() {
|
||||
|
||||
var email = $("#email").val();
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "<?php echo base_url(); ?>/check_if_mail_exists",
|
||||
data:{ email:email , table : 'users'},
|
||||
success:function(response)
|
||||
{
|
||||
if (response == true)
|
||||
{
|
||||
alert("This mail id already exists");
|
||||
$("#email").val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user