vagrillo commited on
Commit
07da134
Β·
verified Β·
1 Parent(s): acc59a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -78,7 +78,8 @@ def login():
78
  else:
79
  error = "❌ Password errata. Riprova."
80
 
81
- return """
 
82
  <!DOCTYPE html>
83
  <html>
84
  <head>
@@ -138,9 +139,14 @@ def login():
138
  <div class="login-form">
139
  <h2>πŸ”’ Accesso Protetto</h2>
140
  <p style="text-align: center; color: #666;">Inserisci la password per accedere al sito</p>
141
- {% if error %}
142
- <div class="error">{{ error }}</div>
143
- {% endif %}
 
 
 
 
 
144
  <form method="POST">
145
  <input type="password" name="password" placeholder="Inserisci la password" required>
146
  <button type="submit">πŸ”‘ Accedi</button>
@@ -148,7 +154,9 @@ def login():
148
  </div>
149
  </body>
150
  </html>
151
- """.replace("{% if error %}", f"{% if error %}" if error else "").replace("{{ error }}", error or "")
 
 
152
 
153
  @app.route('/logout')
154
  def logout():
 
78
  else:
79
  error = "❌ Password errata. Riprova."
80
 
81
+ # Costruisci l'HTML dinamicamente
82
+ html_content = """
83
  <!DOCTYPE html>
84
  <html>
85
  <head>
 
139
  <div class="login-form">
140
  <h2>πŸ”’ Accesso Protetto</h2>
141
  <p style="text-align: center; color: #666;">Inserisci la password per accedere al sito</p>
142
+ """
143
+
144
+ # Aggiungi la sezione error se presente
145
+ if error:
146
+ html_content += f'<div class="error">{error}</div>'
147
+
148
+ # Aggiungi il form
149
+ html_content += """
150
  <form method="POST">
151
  <input type="password" name="password" placeholder="Inserisci la password" required>
152
  <button type="submit">πŸ”‘ Accedi</button>
 
154
  </div>
155
  </body>
156
  </html>
157
+ """
158
+
159
+ return html_content
160
 
161
  @app.route('/logout')
162
  def logout():