<?php
session_start();
require_once('config/config.php');
require_once('class/functions.php');

if (is_user()) {
	redirect(DASHBOARD);
}

dbconnect();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = clean_data($_POST['uEmail']);
if ($_POST['uEmail'] == '') { store_msg("Registered Email required", "danger"); redirect(FORGOT);}
elseif(email_exist($email)) {
$token = getRandomString(32);
update_token($token, $email);
mailresetlink($email,$token);
store_msg("Please check your email for the reset link", "success");
redirect(FORGOT);
}else{
store_msg("Email address is not registered", "danger");
redirect(FORGOT);
}
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title><?php echo WEB_TITLE ?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimal-ui" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <!-- for ios 7 style, multi-resolution icon of 152x152 -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-barstyle" content="black-translucent">
  <link rel="apple-touch-icon" href="assets/images/favicon.png">
  <meta name="apple-mobile-web-app-title" content="<?php echo SMS_SENDER ?>">
  <!-- for Chrome on Android, multi-resolution icon of 196x196 -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="shortcut icon" sizes="196x196" href="assets/images/favicon.png">
  
  <!-- style -->
  <link rel="stylesheet" href="assets/animate.css/animate.min.css" type="text/css" />
  <link rel="stylesheet" href="assets/glyphicons/glyphicons.css" type="text/css" />
  <link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css" type="text/css" />
  <link rel="stylesheet" href="assets/material-design-icons/material-design-icons.css" type="text/css" />

  <link rel="stylesheet" href="assets/bootstrap/dist/css/bootstrap.min.css" type="text/css" />
  <!-- build:css assets/styles/app.min.css -->
  <link rel="stylesheet" href="assets/styles/app.css" type="text/css" />
  <!-- endbuild -->
  <link rel="stylesheet" href="assets/styles/font.css" type="text/css" />
  <?php echo $colors; ?>

</head>
<body>
  <div class="app" id="app">

<!-- ############ LAYOUT START-->
<div class="white h-v row-col">
  <div class="row-cell v-m text-center animated fadeIn">
    <div class="m-b">
      <img src="assets/images/logo.png" class="m-b">
      <?php if (!empty($_SESSION['msg_text'])) {
          $msg = create_alert($_SESSION['msg_text'], $_SESSION['msg_type']);
          echo $msg;
          clear_msg(); }
      ?>
      <div class="m-t-md font-bold">Please enter your registered email address</div>
    </div>
    <form id="Uauth" method="post" action="" autocomplete="off" ui-jp="parsley">
    <div class="md-form-group float-label w-xl w-auto-xs center-block">
    	<input type="text" name="uEmail" class="md-input text-center" data-parsley-error-message="Email is required" required>
    	<label class="block w-full">Email Address</label>
    </div>
    <div>
        <button type="submit" class="btn rounded btn-outline main mainbd p-x-md">Reset Password</button>
	</div>
    </form>
  </div>
</div>

<!-- ############ LAYOUT END-->

  </div>
<!-- build:js scripts/app.html.js -->
<!-- jQuery -->
  <script src="libs/jquery/jquery/dist/jquery.js"></script>
<!-- Bootstrap -->
  <script src="libs/jquery/tether/dist/js/tether.min.js"></script>
  <script src="libs/jquery/bootstrap/dist/js/bootstrap.js"></script>
<!-- core -->
  <script src="libs/jquery/underscore/underscore-min.js"></script>
  <script src="libs/jquery/jQuery-Storage-API/jquery.storageapi.min.js"></script>
  <script src="libs/jquery/PACE/pace.min.js"></script>

  <script src="scripts/config.lazyload.js"></script>

  <script src="scripts/palette.js"></script>
  <script src="scripts/ui-load.js"></script>
  <script src="scripts/ui-jp.js"></script>
  <script src="scripts/ui-include.js"></script>
  <script src="scripts/ui-device.js"></script>
  <script src="scripts/ui-form.js"></script>
  <script src="scripts/ui-nav.js"></script>
  <script src="scripts/ui-screenfull.js"></script>
  <script src="scripts/ui-scroll-to.js"></script>
  <script src="scripts/ui-toggle-class.js"></script>

  <script src="scripts/app.js"></script>

  <!-- ajax -->
  <script src="libs/jquery/jquery-pjax/jquery.pjax.js"></script>
  <script src="scripts/ajax.js"></script>
<!-- endbuild -->
</body>
</html>
