From 7dfbaeba1a4b2309e42276f862efa5b12186f2fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Va=CC=81clav=20Volhejn?= <vaclav.volhejn@gmail.com>
Date: Wed, 30 Dec 2020 19:59:36 +0100
Subject: [PATCH] =?UTF-8?q?Upravit=20podle=20koment=C3=A1=C5=99=C5=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 config.py.example | 2 +-
 mo/util.py        | 2 +-
 mo/web/main.py    | 9 ++++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/config.py.example b/config.py.example
index 8149fb28..e7da720d 100644
--- a/config.py.example
+++ b/config.py.example
@@ -7,4 +7,4 @@ SECRET_KEY = "FIXME"
 SESSION_COOKIE_PATH = '/'
 SESSION_COOKIE_NAME = 'mo_session'
 
-MAIL_FROM = "mo-submit@matfyz.cz"  # FIXME
\ No newline at end of file
+MAIL_FROM = "mo-submit@matfyz.cz"  # FIXME
diff --git a/mo/util.py b/mo/util.py
index c0772882..c86607b4 100644
--- a/mo/util.py
+++ b/mo/util.py
@@ -37,7 +37,7 @@ def send_password_reset_email(user: db.User, link: str):
             addr_spec=user.email,
         )
     ]
-    msg['Subject'] = f'MO Submit – obnova hesla'
+    msg['Subject'] = 'MO Submit – obnova hesla'
     msg['Date'] = datetime.datetime.now()
 
     body = textwrap.dedent('''
diff --git a/mo/web/main.py b/mo/web/main.py
index 2b4355bb..393c929e 100644
--- a/mo/web/main.py
+++ b/mo/web/main.py
@@ -52,7 +52,6 @@ def login():
             except RuntimeError as e:
                 app.logger.error('Login: problém při posílání emailu: {}'.format(e))
 
-            app.logger.info('Link: %s', link)
             return render_template('reset.html')
 
     elif not form.passwd.data or not mo.users.check_password(user, form.passwd.data):
@@ -112,8 +111,12 @@ def reset():
         mo.users.cancel_reset_password(user)
         db.get_session().commit()
         return render_template('reset.html', okay='Obnova hesla zrušena.')
-    elif len(form.passwd.data) < 4:     # FIXME
-        return render_template('reset.html', form=form, error='Heslo je příliš krátké.')
+    elif len(form.passwd.data) < 8:
+        return render_template(
+            'reset.html',
+            form=form,
+            error='Heslo musí být aspoň 8 znaků dlouhé.'
+        )
     else:
         mo.users.do_reset_password(user)
         mo.users.set_password(user, form.passwd.data)
-- 
GitLab