aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-05-20 22:42:43 -0400
committerPaul Duncan <pabs@pablotron.org>2016-05-20 22:42:43 -0400
commit3a6e1f52d920390041fdb0b1991546f61bc1a8ba (patch)
tree29e9479f144819ee137f147935ee76f1eb039c9d
parent406300af9a0264ce149ec63f2a06085385f85f2e (diff)
downloadguff-3a6e1f52d920390041fdb0b1991546f61bc1a8ba.tar.bz2
guff-3a6e1f52d920390041fdb0b1991546f61bc1a8ba.zip
make assets accessible when unauthed, populate login page
-rw-r--r--src/guff.cr7
-rw-r--r--src/views/login-page.ecr99
2 files changed, 74 insertions, 32 deletions
diff --git a/src/guff.cr b/src/guff.cr
index 2468c25..70bbc71 100644
--- a/src/guff.cr
+++ b/src/guff.cr
@@ -242,13 +242,14 @@ module Guff
end
end
- class AssetsHandler < AuthenticatedHandler
+ # TODO: check referrer, add x-frame-options
+ class AssetsHandler < Handler
def initialize(context : Context)
- super(context, %w{admin editor})
+ super(context)
@etags = {} of String => String
end
- def authenticated_call(context : HTTP::Server::Context)
+ def call(context : HTTP::Server::Context)
req_path = context.request.path.not_nil!
if matching_request?(context.request.method, req_path)
diff --git a/src/views/login-page.ecr b/src/views/login-page.ecr
index 644f0ab..5e3c8ce 100644
--- a/src/views/login-page.ecr
+++ b/src/views/login-page.ecr
@@ -3,37 +3,78 @@
<head>
<meta charset="utf-8"/>
<title>Guff Login</title>
+
+ <%=
+ styles %w{
+ ../assets/font-awesome-4.5.0/css/font-awesome.min.css
+ ../assets/bootstrap-3.3.6/css/bootstrap.min.css
+ ../assets/bootstrap-3.3.6/css/bootstrap-theme.min.css
+ }
+ %>
</head>
<body>
- <form method='post'>
- <label for='user'>
- User
- </label>
-
- <input
- type='text'
- id='user'
- name='user'
- title='Enter username'
- />
-
- <label for='pass'>
- Password
- </label>
-
- <input
- type='password'
- id='pass'
- name='pass'
- title='Enter password'
- />
-
- <input
- type='submit'
- value='Login'
- title='Log in to admin panel.'
- />
- </form>
+ <div class='container'>
+ <div class='col-md-6 col-md-offset-3'>
+ <div class='panel panel-default'>
+ <div class='panel-heading'>
+ <b>
+ <i class='fa fa-lock'></i>
+ Guff Login
+ </b>
+ </div><!-- panel-heading -->
+
+ <div class='panel-body'>
+ <form method='post'>
+ <div class='form-group'>
+ <label for='user'>
+ User
+ </label>
+
+ <input
+ type='text'
+ class='form-control'
+ id='username'
+ name='username'
+ title='Enter username'
+ />
+ </div><!-- form-group -->
+
+ <div class='form-group'>
+ <label for='pass'>
+ Password
+ </label>
+
+ <input
+ type='password'
+ class='form-control'
+ id='password'
+ name='password'
+ title='Enter password'
+ />
+ </div><!-- form-group -->
+
+ <div class='form-group'>
+ <button
+ type='submit'
+ class='btn btn-primary'
+ title='Log in to admin panel.'
+ >
+ <i class='fa fa-caret-right'></i>
+ Log In
+ </button>
+ </div><!-- form-group -->
+ </form>
+ </div><!-- panel-body -->
+ </div><!-- panel -->
+ </div><!-- col-md-4 -->
+ </div><!-- container -->
</body>
+
+ <%=
+ scripts %w{
+ ../assets/jquery-2.2.1.min.js
+ ../assets/bootstrap-3.3.6/js/bootstrap.min.js
+ }
+ %>
</html>