From 86c1fa11d474e3246b90e22ec651fb9f5baed5cc Mon Sep 17 00:00:00 2001 From: mrmur Date: Mon, 25 Apr 2022 22:12:00 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F:=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=87=D1=82=D1=8B,=20=D1=84=D0=BE=D1=82=D0=BE=D0=B3?= =?UTF-8?q?=D1=80=D0=B0=D1=84=D0=B8=D0=B8.=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B2=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BF=D0=BE=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/moona_data.db | Bin 86016 -> 86016 bytes main.py | 123 ++++++++++++++++++++++-------------- static/css/diary.css | 4 +- static/css/profile.css | 9 ++- static/css/publications.css | 2 +- templates/profile.html | 57 +++++++---------- 6 files changed, 110 insertions(+), 85 deletions(-) diff --git a/db/moona_data.db b/db/moona_data.db index 0305ff47994025990f9f67862a9d488c00080bea..dde78e5c57738cf51201fa07b1f38f2909d60b86 100644 GIT binary patch delta 93 zcmZozz}m2Yb%HeGl8G|Tj7v5qEY#=bf5E`Szm1W98~^#uf(onnB_){6ITQ0zic&LE xO3M//') @@ -559,46 +572,64 @@ def confirmation(): global send_msg global secret_code global photo - form = help_arg + global help_arg_2 session = db_session.create_session() - conf = Confirmation() - if not send_msg: - secret_code = secret_key() - mail(f'Ваш секретный код: {secret_code}', form.email.data, 'Moona Код') - send_msg = True - if conf.validate_on_submit(): - if str(conf.code_key.data).strip() == str(secret_code).strip(): - if form.photo.data: - user = User( - name=form.name.data, - surname=form.surname.data, - login=form.login.data, - age=form.age.data, - about=form.about.data, - email=form.email.data, - photo=photo, - role='user' - ) + if not help_arg_2: + form = help_arg + if not send_msg: + secret_code = secret_key() + mail(f'Ваш секретный код: {secret_code}', form.email.data, 'Moona Код') + send_msg = True + conf = Confirmation() + if conf.validate_on_submit(): + if str(conf.code_key.data).strip() == str(secret_code).strip(): + if form.photo.data: + user = User( + name=form.name.data, + surname=form.surname.data, + login=form.login.data, + age=form.age.data, + about=form.about.data, + email=form.email.data, + photo=photo, + role='user' + ) + else: + user = User( + name=form.name.data, + surname=form.surname.data, + login=form.login.data, + age=form.age.data, + about=form.about.data, + email=form.email.data, + role='user', + photo='../static/img/Икона.png' + ) + user.set_password(form.password.data) + session.add(user) + session.commit() + send_msg = False + return redirect('/login') else: - user = User( - name=form.name.data, - surname=form.surname.data, - login=form.login.data, - age=form.age.data, - about=form.about.data, - email=form.email.data, - role='user', - photo='../static/img/Икона.png' - ) - user.set_password(form.password.data) - session.add(user) - session.commit() - send_msg = False - return redirect('/login') - else: - return render_template('confirmation_reg.html', title='Подтверждение', form=conf, - message='Коды не совпадают') - return render_template('confirmation_reg.html', title='Подтверждение', form=conf, message='') + return render_template('confirmation_reg.html', title='Подтверждение', form=conf, + message='Коды не совпадают') + return render_template('confirmation_reg.html', title='Подтверждение', form=conf, message='') + else: + conf = Confirmation() + if not send_msg: + secret_code = secret_key() + mail(f'Ваш секретный код: {secret_code}', help_arg_2, 'Moona Код') + send_msg = True + print(secret_code) + if conf.validate_on_submit(): + if str(conf.code_key.data).strip() == str(secret_code).strip(): + user = session.query(User).filter(User.id == current_user.id).first() + user.email = help_arg_2 + help_arg_2 = 'EditEmail' + session.commit() + send_msg = False + return redirect('/profile') + return render_template('confirmation_reg.html', title='Подтверждение', form=conf, message='') @app.route('/register', methods=['GET', 'POST']) diff --git a/static/css/diary.css b/static/css/diary.css index 091d909..b3bef88 100644 --- a/static/css/diary.css +++ b/static/css/diary.css @@ -48,9 +48,9 @@ summary { text-align: center; margin-left: auto; margin-right: auto; - margin-top: 25px; background-color: #7fc3ff; - border-radius: 22px; + border-radius: 50px; + margin-bottom: 20px; } .my_author, .my_post_zag { text-align: center; diff --git a/static/css/profile.css b/static/css/profile.css index a64bdba..6e98d8c 100644 --- a/static/css/profile.css +++ b/static/css/profile.css @@ -36,16 +36,19 @@ table { color: #ffffff; width: 20%; } -.user_posts { - margin-top: 50px; -} .user_posts { width: 35%; margin-right: auto; margin-left: auto; + margin-top: 50px; } .logout_btn { width: 96%; margin-right: 2%; margin-left: 2%; +} +#my_post1 { + background-color: #7fc3ff; + border-radius: 50px; + margin-bottom: 20px; } \ No newline at end of file diff --git a/static/css/publications.css b/static/css/publications.css index 74d4ad4..da17a29 100644 --- a/static/css/publications.css +++ b/static/css/publications.css @@ -23,7 +23,7 @@ table { } .post { background-color: #7fc3ff; - border-radius: 22px; + border-radius: 50px; width: 90%; height: 95%; margin-bottom: 20px; diff --git a/templates/profile.html b/templates/profile.html index e2d74ac..a1551c6 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -30,19 +30,21 @@ +{% if message != '' %} + +{% endif %}

Опубликованные посты

{% if pub_post != [] %} {% for item in pub_post %} -
+
- - {% if item.name != None %} -

{{item.name}}

+ {% if item.name != None %} +

{{item.name}}

{% endif %}
{% if item.text != None %} - {{item.text}} + {{item.text}} {% endif %}
{% if emotion_pub[loop.index0]['pos_emot'] != None %} @@ -51,14 +53,12 @@ Позитивные эмоции -

{% for item2 in emotion_pub[loop.index0]['pos_emot'] %} {{item2}} {% endfor %}
-

{% endif %} {% if emotion_pub[loop.index0]['nig_emot'] != None %}
@@ -73,20 +73,29 @@ {% endfor %}
-

{% endif %} {% if item.photo != None %} -

-

{% endif %} - {% if current_user.is_authenticated %} + {% if emotion_pub[loop.index0]['link'] != None %} +
+ + Ссылки + + {% for item2 in emotion_pub[loop.index0]['link'] %} + + {% endfor %} +
+ {% endif %} - {% endif %} - {% if emotion_pub[loop.index0]['link'] != None %} -
- - Ссылки - -

- {% for item2 in emotion_pub[loop.index0]['link'] %} -
-

- {% endfor %} -
- {% endif %} -
- {{ emotion_pub[loop.index0]['author'].name }} +
+ {{ current_user.name }}
{{item.date}}