<?php
require_once("../app/config.php");
$title="Security";
$error=$_GET['id'];
require_once('include/user_header.php');
require_once('include/user_navbar.php');
require_once('include/user_sidebar.php');
?>
<div class="content-wrapper">

      <!-- Page header -->
      <div class="page-header page-header-light">
        <div class="page-header-content header-elements-md-inline">
        </div>
      </div>
      <div class="content">
          <div class="row">
            <div class="col-lg-12">
              <div class="alert bg-white alert-styled-left alert-dismissible">
                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                  You will be logged out automatically once password is successfully changed
                </div>
              </div>
          </div>
<?php if($error==1){?>   
          <div class="row">
            <div class="col-lg-12">
              <div class="alert bg-secondary text-white alert-styled-left alert-dismissible">
                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                  Incorrect password
                </div>
              </div>
          </div>
<?php }else if($error==2){?>
            <div class="row">
            <div class="col-lg-12">
              <div class="alert bg-secondary text-white alert-styled-left alert-dismissible">
                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                  Passwords doesn't match
                </div>
              </div>
          </div>
<?php }?>
          <div class="row">
    <div class="col-md-12">

      <!-- Basic layout-->
      <div class="card">
        <div class="card-header header-elements-inline">
          <h6 class="card-title font-weight-semibold">Change account password</h6>
              <div class="header-elements">
                <div class="list-icons text-orange-600">
                <a class="list-icons-item" data-action="collapse"></a>

              </div>
            </div>
        </div>

        <div class="card-body">
          <form action="../app/user/password" method="post">
              <div class="form-group row">
                <label class="col-form-label col-lg-2">Old password:</label>
                <div class="col-lg-10">
                  <input type=""hidden value="<?php echo $row['id']; ?>"name="user_id">
                  <input type="password" name="oldpassword" class="form-control" required>
                </div>
              </div>
             <div class="form-group row">
                <label class="col-form-label col-lg-2">New password:</label>
                <div class="col-lg-10">
                  <input type=""hidden value="<?php echo $row['id']; ?>"name="user_id">
                  <input type="password" name="newpassword" class="form-control" required>
                </div>
              </div>  
             <div class="form-group row">
                <label class="col-form-label col-lg-2">Confirm password:</label>
                <div class="col-lg-10">
                  <input type=""hidden value="<?php echo $row['id']; ?>"name="user_id">
                  <input type="password" name="confirmpassword" class="form-control" required>
                </div>
              </div>                
            <div class="text-right">
              <button type="submit" class="btn bg-<?php echo $set['dashboard_color'];?>">Submit<i class="icon-paperplane ml-2"></i></button>
            </div>
          </form>
        </div>
      </div>
      <!-- /basic layout -->
      </div>
    </div>
  </div>
<?php require_once('include/user_footer.php');?>