Don't show images if user is not logged in.

This commit is contained in:
Denis Fedoseev 2017-07-19 12:46:58 +09:00
parent 665c374efd
commit 61bd506af0

View file

@ -212,6 +212,24 @@ __DATA__
</body> </body>
</html> </html>
@@ no_logged.html.ep
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" >
<title>Rough, Slow, Stupid, Contrary Photohosting</title>
</head>
<body>
<h1>Rough, Slow, Stupid, Contrary Photohosting</h1>
<form method="post" action="<%= url_for('login') %>" >
<div>
<input type="text" name="username" >
<input type="password" name="password">
<input type="submit" value="Login">
</div>
</form>
</body>
</html>
@@ index.html.ep @@ index.html.ep
<html> <html>
<head> <head>
@ -221,25 +239,16 @@ __DATA__
<body> <body>
<h1>Rough, Slow, Stupid, Contrary Photohosting</h1> <h1>Rough, Slow, Stupid, Contrary Photohosting</h1>
<% if (is_user_authenticated()) { %> <% if (is_user_authenticated()) { %>
<div><a href="/logout">Logout</a></div> <div><a href="/logout">Logout</a></div>
<hr> <hr>
<form method="post" action="<%= url_for('upload') %>" enctype ="multipart/form-data"> <form method="post" action="<%= url_for('upload') %>" enctype ="multipart/form-data">
<div> <div>
File name File name
<input type="file" name="image" > <input type="file" name="image" >
<input type="submit" value="Upload" > <input type="submit" value="Upload" >
</div> </div>
</form> </form>
<% } else { %> <div>
<form method="post" action="<%= url_for('login') %>" >
<div>
<input type="text" name="username" >
<input type="password" name="password">
<input type="submit" value="Login">
</div>
</form>
<% } %>
<div>
<% foreach my $image (@$images) { %> <% foreach my $image (@$images) { %>
<div> <div>
<hr> <hr>
@ -255,5 +264,15 @@ __DATA__
<div> <div>
<% } %> <% } %>
</div> </div>
<% } else { %>
<form method="post" action="<%= url_for('login') %>" >
<div>
<input type="text" name="username" >
<input type="password" name="password">
<input type="submit" value="Login">
</div>
</form>
<% } %>
</body> </body>
</html> </html>