auth_parts.mak is not needed now that template inheritance is corrected
authorKarl O. Pinc <kop@karlpinc.com>
Wed, 31 Jul 2024 17:56:28 +0000 (12:56 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Wed, 31 Jul 2024 17:56:28 +0000 (12:56 -0500)
src/pgwui_common/templates/auth_base.mak
src/pgwui_common/templates/auth_parts.mak [deleted file]

index cea9f368fbb893c1e3832842640def40e6d1caf5..0245964de8f3ca62df9e691d91622b0c7bfb80ef 100644 (file)
@@ -57,7 +57,6 @@
     import attrs
 
     errors_base_mak = asset_abspath('pgwui_common:templates/errors_base.mak')
-    auth_parts_mak = asset_abspath('pgwui_common:templates/auth_parts.mak')
     lib_mak = asset_abspath('pgwui_common:templates/lib.mak')
 
     @attrs.define
@@ -69,9 +68,6 @@
 %>
 
 <%inherit file="${errors_base_mak}" />
-<%namespace file="${auth_parts_mak}"
-            name="auth_parts"
-            inheritable="True" />
 <%namespace name="lib" file="${lib_mak}" />
 
 <%def name="navbar_content()">
   </%parent:navbar_content>
 </%def>
 
+<%def name="hidden_vars(csrf_token)">
+    <input name="action"
+           type="hidden"
+           value="u"
+           />
+    <input type="hidden"
+           name="csrf_token"
+           value="${csrf_token}"
+           />
+    % if db_changed is not None and db_changed is not UNDEFINED:
+    <%doc>This is a hack.  It should be fixed so that only double-upload
+    detecting forms unconditionally generate this element.</%doc>
+    <input type="hidden"
+           name="db_changed"
+           value="${db_changed}"
+           />
+    % endif
+</%def>
+
 <%doc> All the *_row() defs take a tab_index and, as a side effect,
        increment the tab_index with the number of rows added to the
        table.
 </%doc>
 
+<%def name="user_row(tab_index, havecreds, user)">
+      <tr>
+        <td class="label">
+          <label for="user_id">Username:</label>
+        </td>
+        <td>
+          % if havecreds:
+            <span id="user_id">${user}</span>
+          % else:
+            <input name="user"
+                   tabindex="${tab_index.val}"
+                   id="user_id"
+                   type="text"
+                   size="30"
+                   value=""
+                   />
+          % endif
+          <% tab_index.inc() %>
+        </td>
+      </tr>
+</%def>
+
+<%def name="password_row(tab_index, havecreds)">
+      % if not havecreds:
+        <tr>
+          <td class="label">
+            <label for="password_id">Password:</label>
+          </td>
+          <td>
+            <input name="password"
+                   tabindex="${tab_index.val}"
+                   id="password_id"
+                   type="password"
+                   size="30"
+                   />
+          </td>
+        </tr>
+        <% tab_index.inc() %>
+      % endif
+</%def>
+
 <%def name="main_form(tab_index)">
   <form action="" enctype="multipart/form-data" method="post">
     <div>
-    ${self.auth_parts.hidden_vars(csrf_token)}
+    ${self.hidden_vars(csrf_token)}
     % if (report_success or session_expired) and last_key:
       <input type="hidden"
              name="last_key"
       <%
       if hasattr(caller, 'database_row'):
         caller.database_row(tab_index)
-      self.auth_parts.user_row(tab_index, havecreds, user)
-      self.auth_parts.password_row(tab_index, havecreds)
+      self.user_row(tab_index, havecreds, user)
+      self.password_row(tab_index, havecreds)
 
       caller.body(tab_index)
 
diff --git a/src/pgwui_common/templates/auth_parts.mak b/src/pgwui_common/templates/auth_parts.mak
deleted file mode 100644 (file)
index ca20d4e..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<%doc>
-  Copyright (C) 2015, 2020, 2021, 2024 The Meme Factory, Inc.
-  http://www.karlpinc.com/
-     This file is part of PGWUI_Common.
-    
-     This program is free software: you can redistribute it and/or
-     modify it under the terms of the GNU Affero General Public License
-     as published by the Free Software Foundation, either version 3 of
-     the License, or (at your option) any later version.
-    
-     This program is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-    
-     You should have received a copy of the GNU Affero General Public
-     License along with this program.  If not, see
-     <http://www.gnu.org/licenses/>.
-  Template library of utilities for forms that authenticate a user and
-  accesses a db.
-  Karl O. Pinc <kop@karlpinc.com>
-
-  This template uses the following variables in it's context:
-    havecreds   Already logged in
-    user
-</%doc>
-
-<%def name="hidden_vars(csrf_token)">
-    <input name="action"
-           type="hidden"
-           value="u"
-           />
-    <input type="hidden"
-           name="csrf_token"
-           value="${csrf_token}"
-           />
-    % if db_changed is not None and db_changed is not UNDEFINED:
-    <%doc>This is a hack.  It should be fixed so that only double-upload
-    detecting forms unconditionally generate this element.</%doc>
-    <input type="hidden"
-           name="db_changed"
-           value="${db_changed}"
-           />
-    % endif
-</%def>
-
-<%def name="user_row(tab_index, havecreds, user)">
-      <tr>
-        <td class="label">
-          <label for="user_id">Username:</label>
-        </td>
-        <td>
-          % if havecreds:
-            <span id="user_id">${user}</span>
-          % else:
-            <input name="user"
-                   tabindex="${tab_index.val}"
-                   id="user_id"
-                   type="text"
-                   size="30"
-                   value=""
-                   />
-          % endif
-          <% tab_index.inc() %>
-        </td>
-      </tr>
-</%def>
-
-<%def name="password_row(tab_index, havecreds)">
-      % if not havecreds:
-        <tr>
-          <td class="label">
-            <label for="password_id">Password:</label>
-          </td>
-          <td>
-            <input name="password"
-                   tabindex="${tab_index.val}"
-                   id="password_id"
-                   type="password"
-                   size="30"
-                   />
-          </td>
-        </tr>
-        <% tab_index.inc() %>
-      % endif
-</%def>