# -*- coding: utf-8 -*-
REQUIRE[
- DBIx::Class::Schema
- CGI::Session
- Email::Simple
- Email::Sender
]
USE_COOKIE: 1


FILE: index.yatt
HEADER[
Content-type: ^text/html; charset="?utf-8"?
]
BODY:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
   <title>DB backed, member only site sample</title>
   <link rel="stylesheet" type="text/css" href="main.css">
 </head>
 <body>
 <div id="wrapper">
   <center>
 <div id="body">
   <div id="topnav">
     <h2>DB backed, member only site sample</h2>
   </div>
       <h2>Please login</h2>
     <form action="login.ydo" method="POST">
       <table >
 	<tr>
 	  <th>User:</th>
 	  <td><input type="text" name="login" size="15" /></td>
 	</tr>
 	<tr>
 	  <th>Password:</th>
 	  <td><input type="password" name="password" size="15" /></td>
 	</tr>
 	<tr>
 	  <td colspan="2">
 	    <input type="hidden" name="nx" value="index.yatt" />
 	    <input type="submit" name=":login" value="login" />
 	  </td>
 	</tr>
 	<tr>
 	  <td colspan="2">
 	    <a href="register.yatt?nx=index.yatt">Register</a>
 	    | <a href="resetpass.yatt">Forgot password</a>
 	  </td>
 	</tr>
       </table>
     </form>
   
 </div>
 </center>
 </div>
 </div>
 </body>
 </html>


FILE: login.ydo
METHOD: POST
PARAM{
login: hkoba
password: foo
nx: index.yatt
}
HEADER[
Location: ^index.yatt
]

FILE: index.yatt
BODY:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
   <title>DB backed, member only site sample</title>
   <link rel="stylesheet" type="text/css" href="main.css">
 </head>
 <body>
 <div id="wrapper">
       <div class="login">
       <b>hkoba</b> | <a href="logout.ydo?nx=index.yatt">logout</a>
     </div>
   <center>
 <div id="body">
   <div id="topnav">
     <h2>DB backed, member only site sample</h2>
   </div>
       
   Hello, hkoba!<br>
     
 </div>
 </center>
 </div>
 </div>
 </body>
 </html>

FILE: logout.ydo
METHOD: POST
PARAM{
nx: index.yatt
}
HEADER[
Location: ^index.yatt
]



FILE: index.yatt
HEADER[
Content-type: ^text/html; charset="?utf-8"?
]
BODY:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
   <title>DB backed, member only site sample</title>
   <link rel="stylesheet" type="text/css" href="main.css">
 </head>
 <body>
 <div id="wrapper">
   <center>
 <div id="body">
   <div id="topnav">
     <h2>DB backed, member only site sample</h2>
   </div>
       <h2>Please login</h2>
     <form action="login.ydo" method="POST">
       <table >
 	<tr>
 	  <th>User:</th>
 	  <td><input type="text" name="login" size="15" /></td>
 	</tr>
 	<tr>
 	  <th>Password:</th>
 	  <td><input type="password" name="password" size="15" /></td>
 	</tr>
 	<tr>
 	  <td colspan="2">
 	    <input type="hidden" name="nx" value="index.yatt" />
 	    <input type="submit" name=":login" value="login" />
 	  </td>
 	</tr>
 	<tr>
 	  <td colspan="2">
 	    <a href="register.yatt?nx=index.yatt">Register</a>
 	    | <a href="resetpass.yatt">Forgot password</a>
 	  </td>
 	</tr>
       </table>
     </form>
   
 </div>
 </center>
 </div>
 </div>
 </body>
 </html>


