Ver código fonte

fix hiding signup button when registration is disabled

Pouria Ezzati 1 ano atrás
pai
commit
fc15ecb6cf

+ 1 - 0
server/handlers/locals.handler.js

@@ -25,6 +25,7 @@ function config(req, res, next) {
   res.locals.site_name = env.SITE_NAME;
   res.locals.contact_email = env.CONTACT_EMAIL;
   res.locals.server_ip_address = env.SERVER_IP_ADDRESS;
+  res.locals.disallow_registration = env.DISALLOW_REGISTRATION;
   next();
 }
 

+ 16 - 16
server/views/partials/auth/form.hbs

@@ -28,22 +28,22 @@
       <span>{{> icons/spinner}}</span>
       Log in
     </button>
-    <button 
-      type="button"
-      class="secondary signup" 
-      hx-post="/api/auth/signup" 
-      hx-target="#login-signup" 
-      hx-trigger="click" 
-      hx-indicator="#login-signup" 
-      hx-swap="outerHTML"
-      hx-sync="closest form"
-      hx-on:htmx:before-request="htmx.addClass('#login-signup', 'signup')"
-      hx-on:htmx:after-request="htmx.removeClass('#login-signup', 'signup')"
-    >
-        <span>{{> icons/new_user}}</span>
-        <span>{{> icons/spinner}}</span>
-        Sign up
-    </button>
+      <button 
+        type="button"
+        class="secondary signup" 
+        hx-post="/api/auth/signup" 
+        hx-target="#login-signup" 
+        hx-trigger="click" 
+        hx-indicator="#login-signup" 
+        hx-swap="outerHTML"
+        hx-sync="closest form"
+        hx-on:htmx:before-request="htmx.addClass('#login-signup', 'signup')"
+        hx-on:htmx:after-request="htmx.removeClass('#login-signup', 'signup')"
+      >
+          <span>{{> icons/new_user}}</span>
+          <span>{{> icons/spinner}}</span>
+          Sign up
+      </button>
   </div>
   <a class="forgot-password" href="/reset-password" title="Reset password">Forgot your password?</a>
   {{#unless errors}}

+ 4 - 5
static/css/styles.css

@@ -826,7 +826,7 @@ table tr.loading-placeholder td {
 /* LOGIN & SIGNUP */
 
 form#login-signup {
-  width: 400px;
+  width: 420px;
   max-width: 100%;
   flex: 1 1 auto;
   display: flex;
@@ -848,18 +848,17 @@ form#login-signup input {
 form#login-signup .buttons-wrapper {
   display: flex;
   align-items: center;
+  justify-content: space-between;
   margin-bottom: 1.5rem;
 }
 
 form#login-signup .buttons-wrapper button {
   height: 56px;
-  flex: 1 1 auto;
+  flex: 0 0 48%;
   padding: 0 1rem 2px;
-  margin-right: 1rem;
+  margin: 0;
 }
 
-form#login-signup .buttons-wrapper button:last-child { margin-right: 0; }
-
 form#login-signup a.forgot-password {
   align-self: flex-start;
   font-size: 14px;