umkm-app/application/controllers/user/ResetPassword.php

46 lines
909 B
PHP
Raw Permalink Normal View History

2021-09-17 21:26:28 +07:00
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ResetPassword extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
}
public function index()
{
$data['user_logged'] = $this->session->userdata('user_logged');
if($this->input->get()){
$get = $this->input->get();
if(isset($get['msg'])){
$data['msg'] = $get['msg'];
}
}
if($this->input->post()){
if($this->UserModel->resetPassword($data['user_logged']->id_user)){
redirect(site_url('user/resetpassword?&msg=success'));
} else {
$data['msg']="error!";
}
}
$this->load->view('user/resetpassword',$data);
}
}