<?php


require_once '../settings.php';
if (isset($_SESSION['userdata']) && strpos($link, 'index.php') || strpos($link, 'admin/') && $_SESSION['userdata']['login_type'] != 1) {
	echo '<script>alert(\'Access Denied!\');location.replace(\'' . BASE_URL . '\');</script>';
	exit();
}

echo '<!DOCTYPE html>' . "\r\n" . '<html :class="{ \'theme-dark\': dark }" x-data="data()" lang="en">' . "\r\n" . '<head>' . "\r\n" . '  <meta charset="UTF-8" />' . "\r\n" . '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\r\n" . '  <title>Dashboard</title>' . "\r\n" . '  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />' . "\r\n" . '  <link rel="stylesheet" href="';
echo BASE_URL;
echo 'admin/assets/css/tailwind.output.css" />' . "\r\n" . '  <script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer ></script>' . "\r\n" . '  <script src="';
echo BASE_URL;
echo 'includes/jquery/jquery.min.js"></script>' . "\r\n" . '  <script>' . "\r\n" . '    var _base_url_ = \'';
echo BASE_URL;
echo '\';' . "\r\n" . '  </script>' . "\r\n" . '</head>' . "\r\n" . '<body>' . "\r\n" . '  <div class="flex items-center min-h-screen p-6 bg-gray-50 dark:bg-gray-900">' . "\r\n" . '    <div' . "\r\n" . '    class="flex-1 h-full max-w-2xl mx-auto overflow-hidden bg-white rounded-lg shadow-xl dark:bg-gray-800"' . "\r\n" . '     style="max-width:25rem;">' . "\r\n" . '    <div class="overflow-y-auto">' . "\r\n" . '      <div class="flex items-center justify-center p-6 md:grid-cols-2 xl:grid-cols-2">' . "\r\n" . '        <div class="w-full">' . "\r\n" . '          <h1 class="mb-2 text-xl font-semibold text-gray-700 dark:text-gray-200">Recuperação</h1>' . "\r\n" . '            <form id="recover-password">' . "\r\n" . '                <label class="block text-sm">' . "\r\n" . '                    <span class="text-gray-700 dark:text-gray-400">Usuário</span>' . "\r\n" . '                    <input type="text" name="username" autofocus' . "\r\n" . '                    class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"' . "\r\n" . '                    placeholder="Informe o usuário" required' . "\r\n" . '                    />' . "\r\n" . '                </label>' . "\r\n" . '                <label class="block text-sm mt-2">' . "\r\n" . '                    <span class="text-gray-700 dark:text-gray-400">Email</span>' . "\r\n" . '                    <input type="email" name="email" autofocus' . "\r\n" . '                    class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"' . "\r\n" . '                    placeholder="Informe o email" required' . "\r\n" . '                    />' . "\r\n" . '                </label>' . "\r\n" . '                <button type="submit" class="block w-full px-4 py-2 mt-4 text-sm font-medium leading-5 text-center text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">' . "\r\n" . '                    Enviar redefinição' . "\r\n" . '                </button>' . "\r\n" . '            </form>' . "\r\n" . '  </div>' . "\r\n" . '</div>' . "\r\n" . '</div>' . "\r\n" . '</div>' . "\r\n" . '</div>' . "\r\n" . '</body>' . "\r\n" . '</html>' . "\r\n" . '<script>' . "\r\n" . '     $(document).ready(function(){' . "\r\n" . '        $(\'#recover-password\').submit(function(e){' . "\r\n" . '            e.preventDefault();' . "\r\n" . '            $.ajax({' . "\r\n" . '            url:_base_url_+"class/Main.php?action=recover_password_admin",' . "\r\n" . '            method:\'POST\',' . "\r\n" . '            type:\'POST\',' . "\r\n" . '            data:new FormData($(this)[0]),' . "\r\n" . '            dataType:\'json\',' . "\r\n" . '            cache:false,' . "\r\n" . '            processData:false,' . "\r\n" . '            contentType: false,' . "\r\n" . '            error:err=>{' . "\r\n" . '                //console.log(err)' . "\r\n" . '                alert(\'An error occurred\')' . "\r\n" . '                ' . "\r\n" . '            },' . "\r\n" . '            success:function(resp){' . "\r\n" . '                if(resp.status == \'success\'){' . "\r\n" . '                  alert(\'Um link com a nova senha foi enviada para o seu email. Por favor verifique a caixa de entrada ou spam.\');' . "\r\n" . '                  location.href = (\'./\')                                    ' . "\r\n" . '              }else{' . "\r\n" . '                alert(\'Usuário não encontrado.\')' . "\r\n" . '                //console.log(resp)' . "\r\n" . '            }' . "\r\n" . '        }' . "\r\n" . '    })' . "\r\n" . '       })' . "\r\n" . '    })  ' . "\r\n\r\n" . '</script>';

?>