]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Login page and header login
authorArthurHoaro <arthur@hoa.ro>
Mon, 9 May 2016 22:44:17 +0000 (00:44 +0200)
committerArthurHoaro <arthur@hoa.ro>
Sun, 7 Aug 2016 10:17:36 +0000 (12:17 +0200)
Note: the header login isn't functional

COPYING
tpl/default/404.html [new file with mode: 0644]
tpl/default/css/shaarli.css
tpl/default/img/sad_star.png [new file with mode: 0644]
tpl/default/js/shaarli.js
tpl/default/linklist.html
tpl/default/loginform.html [new file with mode: 0644]
tpl/default/page.header.html

diff --git a/COPYING b/COPYING
index 28939100b8779e12a4f59184bdc2b367e010e50a..d8241e5092e95eb44d0b239eaaa9a9d797cd0668 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -76,6 +76,10 @@ Files: plugins/markdown/Parsedown.php
 License: MIT License (http://opensource.org/licenses/MIT)
 Copyright: (C) 2015 Emanuil Rusev - https://github.com/erusev/parsedown
 
+Files: tpl/default/img/sad_star.png
+License: MIT License (http://opensource.org/licenses/MIT)
+Copyright: (C) 2015 kalvn - https://github.com/kalvn/Shaarli-Material
+
 ----------------------------------------------------
 ZLIB/LIBPNG LICENSE
 
diff --git a/tpl/default/404.html b/tpl/default/404.html
new file mode 100644 (file)
index 0000000..a973816
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+  {include="includes"}
+</head>
+<body>
+<div id="pageheader">
+  {include="page.header"}
+</div>
+<div class="center" id="page404">
+  <h2>Sorry, nothing to see here.</h2>
+  <img src="img/sad_star.png">
+  <p>{$error_message}</p>
+</div>
+{include="page.footer"}
+</body>
+</html>
index 9a07557423eb790fbb5e0c406ee44c431a68b752..14fddc4b11aff97fab5bbca22eda9b59af4e2b7d 100644 (file)
@@ -13,6 +13,10 @@ body {
     clear: both;
 }
 
+.center {
+    text-align: center;
+}
+
 .label {
     display: inline-block;
     padding: .25em .4em;
@@ -63,6 +67,10 @@ pre {
     .pure-u-xl-visible { display: inline-block !important; }
 }
 
+.pure-g [class*="pure-u"]{
+    font-family: Roboto Slab, Arial, sans-serif;
+}
+
 /**
  * Make pure-extras alert closable.
  */
@@ -242,15 +250,20 @@ pre {
 }
 
 #header-login-form {
-    display: none;
-    height: 30px;
-    padding: 5px 0;
+    height: 0;
     text-align: center;
     background: #1b926c;
+    transition: 0.3s;
+}
+
+#header-login-form.open {
+    display: block;
+    height: 30px;
+    padding: 5px 0;
     box-shadow: 0 1px 1px 1px #797979;
 }
 
-#header-login-form input[type="text"], #header-login-form input[type="password"] {
+#header-login-form input[type="text"], #header-login-form input[type="password"], #header-login-form .remember-me {
     margin: 0 0 5px 0;
     padding: 5px 5px 3px 15px;
     height: 20px;
@@ -269,6 +282,17 @@ pre {
     color: #b0ddce;
 }
 
+#header-login-form .remember-me {
+    display: inline-block;
+    width: auto;
+    padding: 5px 20px 3px 20px;
+    cursor: pointer;
+}
+
+#header-login-form .remember-me label, #header-login-form .remember-me input {
+    cursor: pointer;
+}
+
 #header-login-form input[type="submit"] {
     display: inline-block;
     margin: 0 0 5px 0;
@@ -281,6 +305,17 @@ pre {
     color: #b0ddce;
 }
 
+#header-login-form input, #header-login-form .remember-me {
+    transition: visibility 1s, opacity 1s;
+    visibility: hidden;
+    opacity: 0;
+}
+
+#header-login-form.open input, #header-login-form.open .remember-me {
+    visibility: visible;
+    opacity: 1;
+}
+
 .new-version-message {
     text-align: center;
 }
@@ -295,30 +330,31 @@ pre {
  */
 #content {
     position: relative;
-    /* https://css-tricks.com/fighting-the-space-between-inline-block-elements/ */
-    margin-top: -4px;
     /* Hack-ish way to only shadow the top part. */
     box-shadow: 0 -20px 20px -20px #797979;
     z-index: 2;
     background: url(../img/noise.png) #979797;
 }
 
-/**
- * CONTENT - LINKLIST PAGING
- * 64em -> lg
- */
 @media screen and (max-width: 64em) {
-    .linklist-paging {
+    #content {
         margin: 2.1em 0 0 0;
     }
 }
 
 @media screen and (min-width: 64em) {
-    .linklist-paging {
-        margin: 0;
+    #content {
+        /* https://css-tricks.com/fighting-the-space-between-inline-block-elements/ */
+        margin-top: -4px;
     }
 }
 
+/**
+ * CONTENT - LINKLIST PAGING
+ * 64em -> lg
+ */
+
+
 .linklist-filters {
     margin: 10px 0;
     color: #252525;
@@ -399,6 +435,7 @@ pre {
 
 .linklist-item-title, .linklist-item-title h2  {
     margin: 0;
+    word-wrap: break-word;
 }
 
 .linklist-item-title {
@@ -451,6 +488,7 @@ pre {
 .linklist-item-description {
     padding: 10px;
     font-family: Roboto Slab, Arial, sans-serif;
+    word-wrap: break-word;
 }
 
 .linklist-item-description a {
@@ -548,7 +586,73 @@ pre {
 #footer a {
     color: #252525;
 }
+
 /**
+ * Login page
+ */
+#login-form {
+    margin: 20px 0 0 0;
+    background: url(../img/noise.png) #1fa67a;
+    border-radius: 5px;
+    box-shadow: 1px 1px 2px #797979;
+}
+
+#login-form h2 {
+    margin: 0 0 10px 0;
+    padding: 10px 0;
+    width: 100%;
+    color: #b0ddce;
+    background: #1b926c;
+    text-align: center;
+    border-radius: 5px 5px 0 0;
+    border-bottom: 1px solid #797979;
+}
+
+#login-form div {
+    width: 100%;
+    text-align: center;
+}
+
+#login-form input[type="text"], #login-form input[type="password"] {
+    margin: 10px 0;
+    padding: 5px 5px 3px 15px;
+    height: 30px;
+    width: 80%;
+    background: #1b926c;
+    border: medium none currentColor;
+    border-radius: 25px;
+    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.078), 0 1px 4px rgba(0, 0, 0, 0.298) inset;
+    color: #b0ddce;
+}
+
+/* because chrome */
+#login-form input[type="text"]::-webkit-input-placeholder,
+#login-form input[type="password"]::-webkit-input-placeholder {
+    color: #b0ddce;
+}
+
+#login-form .remember-me {
+    margin: 5px 0;
+    color: #b0ddce;
+    font-weight: bold;
+}
+
+#login-form input[type="submit"] {
+    margin: 10px 0;
+    height: 35px;
+    width: 150px;
+    background: #1b926c;
+    border: medium none currentColor;
+    border-radius: 25px;
+    box-shadow: 1px 1px 4px #0C7653, -1px -1px 6px #0C7653, -1px 1px 6px #0C7653, 1px -1px 6px #0C7653;
+    font-size: 1.2em;
+    font-weight: bold;
+    color: #b0ddce;
+}
+
+#page404 {
+    color: #3f3f3f;
+}/**
  * CONTENT - LINKLIST ITEMS
  */
 .linklist-item {
diff --git a/tpl/default/img/sad_star.png b/tpl/default/img/sad_star.png
new file mode 100644 (file)
index 0000000..ed3bd15
Binary files /dev/null and b/tpl/default/img/sad_star.png differ
index 8e541998d6b59e2513f59b4ded26cde8778486de..f24aff736a445061562e52c729f50366f48ebf63 100644 (file)
@@ -144,12 +144,18 @@ if (newVersionDismiss != null) {
  * Login button
  */
 var loginButton = document.getElementById('login-button');
+var loginBlock = document.getElementById('header-login-form');
+
 loginButton.addEventListener('click', function(event) {
     event.preventDefault();
-    var loginBlock = document.getElementById('header-login-form');
-    loginBlock.style.display = 'block';
     loginBlock.classList.toggle('open');
-    // Focus on login field.
-    loginBlock.firstElementChild.focus();
     document.getElementById('content').style.boxShadow = 'none';
 });
+
+// Focus on login field.
+loginBlock.addEventListener('transitionend', function() {
+    loginBlock.firstElementChild.focus();
+});
+
+var hiddenReturnurl = document.getElementsByName('returnurl');
+hiddenReturnurl.value = window.location.href;
\ No newline at end of file
index 964cc400d2db301c98331122e5ffa87250272721..4a0f44c6a3977e867273aaed672e0e87be89ae94 100644 (file)
@@ -94,7 +94,7 @@
             {/if}
 
             <div class="pure-g">
-              <div class="linklist-item-infos-dateblock pure-u-lg-3-8 pure-u-sm-1">
+              <div class="linklist-item-infos-dateblock pure-u-lg-3-8 pure-u-1">
                 <a href="?{$value.shorturl}" title="Permalink">
                   {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
                     <span class="linkdate">
                   {if="$link_plugin_counter - 1 != $counter"}&middot;{/if}
                 {/loop}
               </div>
-              <div class="linklist-item-infos-url pure-u-lg-5-8 pure-u-sm-1">
+              <div class="linklist-item-infos-url pure-u-lg-5-8 pure-u-1">
                 <a href="{$value.real_url}" title="{$value.title}">
                   <i class="fa fa-link"></i> {$value.url}
                 </a>
diff --git a/tpl/default/loginform.html b/tpl/default/loginform.html
new file mode 100644 (file)
index 0000000..0ee9615
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+  {include="includes"}
+</head>
+<body>
+{include="page.header"}
+{if="!ban_canLogin()"}
+<div class="pure-g pure-alert pure-alert-error pure-alert-closable center">
+  <div class="pure-u-2-24"></div>
+  <div class="pure-u-20-24">
+    You have been banned after too many failed login attempts. Try again later.
+  </div>
+  <div class="pure-u-2-24">
+    <i class="fa fa-times pure-alert-close"></i>
+  </div>
+</div>
+{else}
+  <div class="pure-g">
+    <div class="pure-u-lg-1-3 pure-u-1-8"></div>
+    <div id="login-form" class="pure-u-lg-1-3 pure-u-3-4">
+      <form method="post" name="loginform">
+        <h2>Login</h2>
+        <div>
+          <input type="text" name="login" placeholder="Username" tabindex="3">
+        </div>
+        <div>
+          <input type="password" name="password" placeholder="Password" tabindex="4">
+        </div>
+        <div class="remember-me">
+          <input type="checkbox" name="longlastingsession" id="longlastingsession" tabindex="5">
+          <label for="longlastingsession">Remember me</label>
+        </div>
+        <div>
+          <input type="submit" value="Login" class="bigbutton" tabindex="6">
+        </div>
+        <input type="hidden" name="token" value="{$token}">
+        {if="$returnurl"}<input type="hidden" name="returnurl" value="{$returnurl}">{/if}
+      </form>
+    </div>
+    <div class="pure-u-lg-1-3 pure-u-1-8"></div>
+  </div>
+
+{/if}
+
+
+</div>
+
+{include="page.footer"}
+<script>
+  document.getElementsByName('login')[1].focus();
+</script>
+</body>
+</html>
+
index e6cf5affc31943964ca9ace93bbc0191ec45db4b..e368d00d8e12f504d8f0f0070702d8b3fd51d769 100644 (file)
@@ -12,7 +12,7 @@
   </div>
   <div class="pure-u-1">
     <div class="pure-menu menu-transform pure-menu-horizontal pure-g">
-      <ul class="pure-menu-list pure-u-lg-11-12 pure-u-sm-1">
+      <ul class="pure-menu-list pure-u-lg-11-12 pure-u-1">
         <li class="pure-menu-item pure-menu-selected pure-u-0 pure-u-lg-visible">
           <a href="{if="!empty($GLOBALS['titleLink'])"}{$GLOBALS['titleLink']}{else}?{/if}"
             class="pure-menu-link">
           </li>
         {/if}
       </ul>
-      <div class="header-buttons pure-u-lg-1-12 pure-u-sm-0 pure-u-lg-visible">
+      <div class="header-buttons pure-u-lg-1-12 pure-u-0 pure-u-lg-visible">
         <ul class="pure-menu-list">
           {if="!isLoggedIn()"}
             <li class="pure-menu-item">
-              <a href="?do=login" class="pure-menu-link" id="login-button">
+              <a href="?do=login" class="pure-menu-link" id="login-button" title="Login">
                 <i class="fa fa-user"></i>
               </a>
             </li>
+          {else}
+            <li class="pure-menu-item">
+              <a href="?do=logout" class="pure-menu-link" title="Logout">
+                <i class="fa fa-sign-out"></i>
+              </a>
+            </li>
           {/if}
           <li class="pure-menu-item">
-            <a href="?do=atom{$searchcrits}" class="pure-menu-link">
+            <a href="?do=atom{$searchcrits}" class="pure-menu-link" title="ATOM Feed">
               <i class="fa fa-rss"></i>
             </a>
           </li>
         {if="!empty($search_crits) && $search_type=='fulltext'"}
           value="{$search_crits}"
         {/if}
+        tabindex="1"
       >
       <button type="submit" class="search-button"><i class="fa fa-search"></i></button>
     </form>
         {/if}
         autocomplete="off" data-multiple data-minChars="1"
         data-list="{loop="$tags"}{$key}, {/loop}"
+        tabindex="2"
       >
       <button type="submit" class="search-button"><i class="fa fa-search"></i></button>
     </form>
 </div>
 
 <div id="content">
-  <div id="header-login-form">
-    <input type="text" name="login" placeholder="Username">
-    <input type="password" name="password" placeholder="Password">
-    <input type="submit" value="Login">
-  </div>
+  <form method="post" name="loginform">
+    <div id="header-login-form">
+      <input type="text" name="login" placeholder="Username" tabindex="3">
+      <input type="password" name="password" placeholder="Password" tabindex="5">
+      <div class="remember-me">
+        <input type="checkbox" name="longlastingsession" id="longlastingsession" tabindex="6">
+        <label for="longlastingsession">Remember me</label>
+      </div>
+      <input type="hidden" name="token" value="{$token}">
+      <input type="hidden" name="returnurl">
+      <input type="submit" value="Login" tabindex="7">
+    </div>
+  </form>
 
 {if="!empty($newVersion) || !empty($versionError)"}
   <div class="pure-g new-version-message pure-alert pure-alert-warning pure-alert-closable">