Compare commits

...

10 Commits

Author SHA1 Message Date
70395b4efe добавил конфиг в гит игнор 2024-12-02 23:45:08 +05:00
beb5668f0c убрал лишнее из репозитория 2024-12-02 23:44:40 +05:00
c1a7dd7bbd второй пробный конфиг для докер компоус :) 2024-12-02 23:29:20 +05:00
f5e4f0b0c5 пробный конфиг для докер компоус 2024-12-02 23:15:54 +05:00
Dinosaur
657ea0ccf6
Update README.md 2024-04-12 09:24:31 +03:00
5915b15257 Изменил файл с доменом, README.md, удалил базу данных т. к. на гите она не нужна. Также убрал пароли и ключи шифрования из файлов 2022-12-16 17:52:59 +05:00
Andrei
aa56dba330 Создан новый редактор профиля, прошлый был отключен и удален. Выпадающий список для перемещения по сайту был добавлен в раздел дневника. В разделе дневника убрал регистрацию, изменение профиля и авторизацию, теперь эти функции берет на себя основной раздел. 2022-11-18 23:02:29 +05:00
Andrei
9267b8f39b В SafeAppSchool добавлен виджет обратной связи ВК 2022-11-15 15:09:09 +05:00
Andrei
d37496bdbf Заменил параметр age на дату рождения, и в базе данных и в формах 2022-11-03 22:34:57 +05:00
Andrei
fb555005e8 Изменены страницы для SafeAppSchool 2022-11-02 21:14:50 +05:00
141 changed files with 1004 additions and 404 deletions

11
.gitignore vendored
View File

@ -1,4 +1,7 @@
/documents/voucher_moonadiary.ru.pdf
/db/moona_data.db
/main.log
/.gitignore
/moona/documents/
/moona/documents
/moona/db/moona_data.db
/moona/main.log
/.gitignore
__pycache__
/protect.moona

View File

@ -1,21 +1,36 @@
# P.S.
Это мой первый сайт, который я разрабатывал вместе с Дарьей Толменевой, когда мы учились в Яндекс Лицее.
# MOONA
![alt text](https://github.com/AndreiDuvakin/WebServerProject/blob/main/static/img/НадписьMoona.png)
**moona** это сайт-дневник, который позволяет поделится своими мыслями с другими пользователями. На сайте после регистрации, можно добавлять записи в свой личный дневник и при желании делать запись доступной для всех пользователей сайта.
Moona выполнена в светло-голубых тонах, чтобы пользователей ничего не отвлекало от использования нашего сайта. На нашем сайте каждый сможет найти что-то подходящее для себя: каждый в праве писать посты для всех или только для себя.
![string_moona.png](moona/static/img/string_moona.png)
**moona** это сайт-дневник, который позволяет поделится своими мыслями с другими пользователями. На сайте после
регистрации, можно добавлять записи в свой личный дневник и при желании делать запись доступной для всех пользователей
сайта.
Чуть позже здесь появятся картинки нашего сайта с окончательным дизайном, нужно лишь чуть чуть подождать
Moona выполнена в светло-голубых тонах, чтобы пользователей ничего не отвлекало от использования нашего сайта. На нашем
сайте каждый сможет найти что-то подходящее для себя: каждый в праве писать посты для всех или только для себя.
Посмотреть наш сайт вы можете перейдя по ссылке https://moonadiary.ru/
Чуть позже здесь появятся картинки нашего сайта с окончательным дизайном, нужно лишь чуть чуть подождать
Посмотреть наш сайт вы можете перейдя по ссылке https://moona.net.ru/diary/
____
# Контактики
### Email:
### Email:
- andrei@duvakin.ru
- tolmenevadarya@yandex.ru
- moonadiary@yandex.ru (оффициальная почта)
### VK:
- https://vk.com/andreiduvakin
- https://vk.com/s_plombir19
### Telegram:
- @andrei_duvakin
- @DinPg

Binary file not shown.

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: '3.8'
services:
app_moona:
build:
context: ./moona
volumes:
- ./moona/db:/app/db
- ./moona/static:/app/static
environment:
- SECRET_KEY=your-secret-key
restart: always

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,5 +0,0 @@
#1daff0
#a9e4ff
#42e6ec
#c5f1ff
#7fc3ff

View File

@ -1,24 +0,0 @@
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 2
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1

15
moona/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM python:3.10-slim
RUN apt-get update && apt-get install -y \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]

View File

@ -25,6 +25,7 @@ class User(SqlAlchemyBase, UserMixin):
default=date.today())
role = sqlalchemy.Column(sqlalchemy.String, nullable=True)
activity = sqlalchemy.Column(sqlalchemy.Date, nullable=True)
birthday = sqlalchemy.Column(sqlalchemy.Date, nullable=True)
def check_password(self, password):
return check_password_hash(self.password, password)

View File

@ -1,6 +1,6 @@
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed
from wtforms import EmailField, StringField, PasswordField, SubmitField, FileField, IntegerField, TextAreaField
from wtforms import EmailField, StringField, PasswordField, SubmitField, FileField, DateField, TextAreaField
from wtforms.validators import DataRequired
@ -9,7 +9,7 @@ class RegisterForm(FlaskForm):
name = StringField('Имя', validators=[DataRequired()])
surname = StringField('Фамилия', validators=[DataRequired()])
login = StringField('Логин', validators=[DataRequired()])
age = IntegerField('Возраст')
birthday = DateField('Дата рождения', validators=[DataRequired()])
about = TextAreaField('Расскажите о себе', default='')
photo = FileField('Фото', validators=[FileAllowed(['jpg', 'png'], 'Images only!')])
password = PasswordField('Пароль', validators=[DataRequired()])

4
moona/main.log Normal file
View File

@ -0,0 +1,4 @@
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1

View File

@ -28,7 +28,7 @@ from forms.register import RegisterForm, Confirmation
from post import mail
app = Flask(__name__)
app.config['SECRET_KEY'] = 'moona_secret_key'
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'default_key_for_dev')
logging.basicConfig(filename='main.log')
login_manager = LoginManager()
login_manager.init_app(app)
@ -86,58 +86,120 @@ def main_page():
@app.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
return redirect('/')
return render_template('main/login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('main/login.html', title='Авторизация', form=form, message='')
if not current_user.is_authenticated:
redir = request.args.get('redir') if request.args.get('redir') else False
form = LoginForm()
if form.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
if redir:
return redirect(f'/{redir}')
else:
return redirect('/')
return render_template('main/login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('main/login.html', title='Авторизация', form=form, message='')
else:
return redirect('/')
@app.route('/register', methods=['GET', 'POST'])
def register():
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('main/register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
data_session = db_session.create_session()
if data_session.query(User).filter(User.login == form.login.data).first():
return render_template('main/register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if data_session.query(User).filter(User.email == form.email.data).first():
return render_template('main/register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
else:
photo = False
session['ps'] = form.password.data
return redirect(
url_for('confirmation', photo=photo, name=form.name.data, surname=form.surname.data, login=form.login.data,
age=form.age.data, about=form.about.data, email=form.email.data, form=True))
return render_template('main/register.html', title='Регистрация', form=form, message='')
if not current_user.is_authenticated:
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('main/register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
data_session = db_session.create_session()
if data_session.query(User).filter(User.login == form.login.data).first():
return render_template('main/register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if data_session.query(User).filter(User.email == form.email.data).first():
return render_template('main/register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
else:
photo = False
session['ps'] = form.password.data
return redirect(
url_for('confirmation', photo=photo, name=form.name.data, surname=form.surname.data,
login=form.login.data,
birthday=form.birthday.data, about=form.about.data, email=form.email.data, form=True))
return render_template('main/register.html', title='Регистрация', form=form, message='')
else:
return redirect('/')
@app.route('/user/<string:login>', methods=['GET', 'POST'])
def profile(login):
if current_user.is_authenticated and current_user.login == login:
message = request.args.get('message') if request.args.get('message') else ''
form = RegisterForm()
if form.del_photo.data:
data_session = db_session.create_session()
user = data_session.query(User).filter(User.id == current_user.id).first()
os.remove(user.photo)
user.photo = '/static/img/None_logo.png'
data_session.commit()
data_session.close()
return redirect(f'/user/{login}')
if request.method == 'GET':
form.email.data = current_user.email
form.name.data = current_user.name
form.surname.data = current_user.surname
form.birthday.data = current_user.birthday
form.about.data = current_user.about
form.photo.data = current_user.photo if current_user.photo and 'None' not in current_user.photo else None
if form.submit2.data:
data_session = db_session.create_session()
user = data_session.query(User).filter(User.id == current_user.id).first()
if user:
if form.photo.data != current_user.photo:
if form.photo.data:
user.photo = save_photo(form.photo.data, login)
user.name = form.name.data
user.surname = form.surname.data
user.birthday = form.birthday.data
user.about = form.about.data
data_session.commit()
data_session.close()
if form.email.data != current_user.email:
if data_session.query(User).filter(User.email == form.email.data).first():
return redirect(f'/user/{login}?message=Такая почта уже есть')
session['ps'] = None
return redirect(
url_for('confirmation', email_conf=True, email=form.email.data, form=True)
)
return redirect(f'/user/{login}')
else:
abort(404)
return render_template('main/profile.html', title='Профиль', form=form, message=message)
elif current_user.is_authenticated and current_user.login != login:
pass
else:
return redirect('/login')
@app.route('/confirmation', methods=['GET', 'POST'])
def confirmation():
if request.args.get('form'):
app_school = request.args.get('app_school') if request.args.get('app_school') else False
email_conf = request.args.get('email_conf') if request.args.get('email_conf') else False
data_session = db_session.create_session()
form = RegisterForm(
name=request.args.get('name'),
surname=request.args.get('surname'),
login=request.args.get('login'),
age=request.args.get('age'),
birthday=request.args.get('birthday'),
about=request.args.get('about'),
email=request.args.get('email'),
password=session['ps']
@ -163,47 +225,59 @@ def confirmation():
conf = Confirmation()
if conf.validate_on_submit():
if str(conf.code_key.data).strip() == str(session['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=session['photo'],
role='user'
)
if not email_conf:
if form.photo.data:
user = User(
name=form.name.data,
surname=form.surname.data,
login=form.login.data,
birthday=datetime.datetime.strptime(form.birthday.data, "%Y-%m-%d").date(),
about=form.about.data,
email=form.email.data,
photo=save_photo(session['photo'], form.login.data),
role='user'
)
else:
user = User(
name=form.name.data,
surname=form.surname.data,
login=form.login.data,
birthday=datetime.datetime.strptime(form.birthday.data, "%Y-%m-%d").date(),
about=form.about.data,
email=form.email.data,
role='user',
photo='/static/img/None_logo.png'
)
user.set_password(form.password.data)
data_session.add(user)
data_session.commit()
data_session.close()
session['send_msg'] = False
if app_school:
return redirect('/safeappschool/login')
else:
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/None_logo.png'
)
user.set_password(form.password.data)
data_session.add(user)
data_session.commit()
session['send_msg'] = False
if app_school:
return redirect('/safeappschool/login')
else:
return redirect('/login')
user = data_session.query(User).filter(User.id == current_user.id).first()
if user:
user.email = form.email.data
data_session.commit()
data_session.close()
return redirect(f'/user/{current_user.login}')
else:
abort(404)
else:
session['no_code'] = True
if app_school:
return render_template('simple/simple_confirmation.html', title='Подтверждение', form=conf,
return render_template('safe_app_school/confirmation.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('main/confirmation_reg.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
if app_school:
return render_template('simple/simple_confirmation.html', title='Подтверждение', form=conf, message='')
return render_template('safe_app_school/confirmation.html', title='Подтверждение', form=conf,
message='')
else:
return render_template('main/confirmation_reg.html', title='Подтверждение', form=conf, message='')
else:
@ -213,8 +287,12 @@ def confirmation():
@app.route('/logout')
@login_required
def logout():
path = request.args.get('path')
logout_user()
return redirect("/")
if not path:
return redirect("/")
else:
return redirect(f'/{path}')
@app.route('/safeappschool')
@ -232,47 +310,54 @@ def safe_app_school_main():
@app.route('/safeappschool/login', methods=['GET', 'POST'])
def safe_app_school_login():
form = LoginForm()
if form.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
return redirect('/safeappschool/main')
return render_template('/simple/simple_login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('/simple/simple_login.html', title='Вход', form=form, message='')
if current_user.is_authenticated:
return redirect('/safeappschool/main')
else:
form = LoginForm()
if form.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
return redirect('/safeappschool/main')
return render_template('/safe_app_school/login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('/safe_app_school/login.html', title='Вход', form=form, message='')
@app.route('/safeappschool/register', methods=['GET', 'POST'])
def safe_app_school_register():
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
data_session = db_session.create_session()
if data_session.query(User).filter(User.login == form.login.data).first():
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if data_session.query(User).filter(User.email == form.email.data).first():
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
else:
photo = False
session['ps'] = form.password.data
return redirect(
url_for('confirmation', photo=photo, name=form.name.data, surname=form.surname.data,
login=form.login.data,
age=form.age.data, about=form.about.data, email=form.email.data, form=True, app_school=True))
return render_template('simple/simple_register.html', title='Регистрация', form=form, message='')
if current_user.is_authenticated:
return redirect('/safeappschool/main')
else:
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
data_session = db_session.create_session()
if data_session.query(User).filter(User.login == form.login.data).first():
return render_template('safe_app_school/register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if data_session.query(User).filter(User.email == form.email.data).first():
return render_template('safe_app_school/register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
else:
photo = False
session['ps'] = form.password.data
return redirect(
url_for('confirmation', photo=photo, name=form.name.data, surname=form.surname.data,
login=form.login.data,
birthday=form.birthday.data, about=form.about.data, email=form.email.data, form=True,
app_school=True))
return render_template('safe_app_school/register.html', title='Регистрация', form=form, message='')
@app.route('/safeappschool/about')
@ -322,11 +407,11 @@ def safe_app_school_go(point):
with open('static/js/safe_app_school/mapbasics_templates.js', 'r', encoding='utf-8') as file:
new_file = file.read().split('<point1>')
new_file = new_file[
0] + f'\'{str(address.home_address).strip() if point == "home" else str(address.school_address).strip()}\'' \
0] + f'\'{str(address.home_address).strip() if point == "school" else str(address.school_address).strip()}\'' \
+ new_file[1]
new_file = new_file.split('<point2>')
new_file = new_file[
0] + f'\'{str(address.school_address).strip() if point == "home" else str(address.home_address).strip()}\'' + \
0] + f'\'{str(address.school_address).strip() if point == "school" else str(address.home_address).strip()}\'' + \
new_file[1]
with open(f'static/js/safe_app_school/{str(current_user.id)}mapbasics.js', 'w',
encoding='utf-8') as new_js:
@ -364,7 +449,7 @@ def edit_profile(logins):
form = RegisterForm()
session = db_session.create_session()
ph_f = False
if current_user.photo != '../../static/img/None_logo.png':
if 'None_logo' not in current_user.photo:
photo = current_user.photo
ph_f = True
else:
@ -372,7 +457,6 @@ def edit_profile(logins):
if form.del_photo.data:
help_arg = photo
ph_f = False
photo = '../../static/img/None_logo.png'
if form.submit2.data:
user = session.query(User).filter(User.login == logins).first()
if user.email != form.email.data:
@ -388,11 +472,12 @@ def edit_profile(logins):
return redirect('/diary/confirmation')
user.name = form.name.data
user.surname = form.surname.data
user.age = form.age.data
user.birthday = form.birthday.data
user.about = form.about.data
photo = '../../static/img/None_logo.png'
if not ph_f and form.photo.data:
photo = save_photo(form.photo.data, logins)
if help_arg:
if help_arg == photo:
os.remove(help_arg)
help_arg = False
photo = '../../static/img/None_logo.png'
@ -410,7 +495,7 @@ def edit_profile(logins):
form.name.data = current_user.name
form.surname.data = current_user.surname
form.login.data = logins
form.age.data = current_user.age
form.birthday.data = current_user.birthday
form.about.data = current_user.about
form.password.data = None
form.password2.data = None
@ -423,7 +508,7 @@ def edit_profile(logins):
@app.route('/diary/profile')
def profile():
def diary_profile():
if current_user.is_authenticated:
global help_arg_2
db_sess = db_session.create_session()
@ -728,7 +813,7 @@ def post_edit(id):
post_exc.nig_emot = post_ed.nig_emot.data
post_exc.link = post_ed.link.data
if help_arg:
os.remove(help_arg[3:])
os.remove(help_arg)
help_arg = False
if post_ed.photo.data:
post_exc.photo = save_photo(post_ed.photo.data, current_user.login, post=True,
@ -762,7 +847,7 @@ def post_deleted(id):
pos = session.query(DiaryPost).filter(DiaryPost.id == id).first()
if pos:
if pos.photo:
os.remove(pos.photo[3:])
os.remove(pos.photo)
likes = session.query(Like).filter(Like.post == pos.id).all()
if likes:
list(map(lambda i: session.delete(i), likes))
@ -915,172 +1000,11 @@ def diary_logout():
return redirect("/diary/")
@app.route('/diary/login', methods=['GET', 'POST'])
def diary_login():
form = LoginForm()
if form.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
return redirect("/diary/")
return render_template('diary/login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('diary/login.html', title='Авторизация', form=form, message='')
@app.route('/diary/confirmation', methods=['GET', 'POST'])
def diary_onfirmation():
global help_arg
if help_arg:
global send_msg
global secret_code
global photo
global help_arg_2
session = db_session.create_session()
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/None_logo.png'
)
user.set_password(form.password.data)
session.add(user)
session.commit()
send_msg = False
help_arg = False
if form.simple:
return redirect('/diary/simple/can_close')
else:
return redirect('/diary/login')
else:
if form.simple:
return render_template('simple/simple_confirmation.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('diary/confirmation_reg.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
if form.simple:
return render_template('simple/simple_confirmation.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('diary/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
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
help_arg = False
return redirect('/diary/profile')
if form.simple:
return render_template('simple_confirmation.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('diary/confirmation_reg.html', title='Подтверждение', form=conf, message='')
else:
return redirect('/diary/')
@app.route('/diary/register', methods=['GET', 'POST'])
def diary_register():
global help_arg
global photo
form = RegisterForm()
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
session = db_session.create_session()
if session.query(User).filter(User.login == form.login.data).first():
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if session.query(User).filter(User.email == form.email.data).first():
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
help_arg = form
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
return redirect('/diary/confirmation')
return render_template('diary/register.html', title='Регистрация', form=form, message='')
@app.route('/diary/about_us')
def about():
return render_template('diary/about.html', title='О нас')
@app.route('/diary/recovery', methods=['GET', 'POST'])
def recovery():
global send_msg
global secret_code
global help_arg
global user_email
form = RecoveryForm()
conf = Conf()
finish = Finish()
session = db_session.create_session()
if form.validate_on_submit() and form.email.data:
user_email = form.email.data
if not send_msg:
secret_code = secret_key()
mail(f'Ваш секретный код: {secret_code}', form.email.data, 'Восстановление пароля')
send_msg = True
return render_template('diary/recovery.html', title='Восстановление пароля', form=conf, message='', s='2')
if conf.validate_on_submit():
if str(conf.code_key.data).strip() == str(secret_code).strip():
help_arg = True
return render_template('diary/recovery.html', title='Восстановление пароля', form=finish, message='', s='3')
if help_arg:
if finish.validate_on_submit():
db_sess = db_session.create_session()
user = db_sess.query(User).filter(User.email == user_email).first()
user.set_password(finish.password.data)
user2 = session.merge(user)
session.add(user2)
session.commit()
send_msg = False
return redirect('/diary/login')
return render_template('diary/recovery.html', title='Восстановление пароля', form=form, message='', s='1')
@app.route('/school_app_check_auth', methods=['POST'])
def check_auth():
req = request.json

View File

@ -15,7 +15,9 @@ def mail(msg, to, topic='No temes'):
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login('moonadiary', 'fiX-2Vb-6a2-kCi')
auth = open('../protect.moona', 'r', encoding='utf-8').read().split()
login, password = auth[0], auth[1]
mailServer.login(login, password)
mailServer.ehlo()
mailServer.send_message(em)
mailServer.quit()

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 198 KiB

View File

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 245 KiB

View File

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

@ -14,4 +14,9 @@ body {
margin-right: auto;
text-align: center;
margin-top: 50px;
}
.user {
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 19px;
border: 2px solid #ffffff;
}

View File

View File

@ -36,8 +36,12 @@
width: 10%;
margin-left: 12px;
height: 42px;
color: #ffffff;
transition: box-shadow 1s ease-in, border 0.3s ease-in, background 2s ease-in;
}
.back_text {
margin-top: 7%;
text-align: center;
.back:hover
{
border: 4px solid #ffffff;
box-shadow: 0px 0px 50px #fff;
background: rgb(0, 222, 0);
}

View File

@ -41,8 +41,12 @@
width: 10%;
margin-left: 12px;
height: 42px;
color: #ffffff;
transition: box-shadow 1s ease-in, border 0.3s ease-in, background 2s ease-in;
}
.back_text {
margin-top: 7%;
text-align: center;
.back:hover
{
border: 4px solid #ffffff;
box-shadow: 0px 0px 50px #fff;
background: rgb(0, 222, 0);
}

View File

@ -70,9 +70,9 @@
height: 60px;
}
.user {
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 19px;
border: 2px solid #ffffff;
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
}
.button {
width: 160px;

View File

@ -0,0 +1,60 @@
.profile {
width: 70%;
margin-left: auto;
margin-right: auto;
}
.head {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.user_photo {
border-radius: 50%;
width: 35%;
margin-left: 32%;
margin-right: 32%;
border: 5px solid #ffffff;
transition: box-shadow 1s ease-in, border 1s ease-in;
}
.user_photo:hover {
border: 2px solid #ffffff;
box-shadow: 0px 0px 50px #fff;
}
.user_name {
text-align: center;
color: white;
margin-left: 27%;
margin-right: 27%;
width: 46%;
height: auto;
margin-top: 15px;
transition: font-size 1s ease-in, text-shadow 1s ease-in;
}
.user_name:hover {
font-size: 45;
text-shadow: 0px 0px 20px #ffffff;
}
.photo_buttons {
margin-top: 5px;
margin-left: 15px;
}
.submit_button {
margin-top: 5px;
margin-left: 45%;
}
.back {
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 19px;
border: 2px solid #ffffff;
width: 10%;
margin-left: 12px;
height: 42px;
color: #ffffff;
transition: box-shadow 1s ease-in, border 0.3s ease-in, background 2s ease-in;
}
.back:hover
{
border: 4px solid #ffffff;
box-shadow: 0px 0px 50px #fff;
background: rgb(0, 222, 0);
}

View File

@ -36,8 +36,12 @@
width: 10%;
margin-left: 12px;
height: 42px;
color: #ffffff;
transition: box-shadow 1s ease-in, border 0.3s ease-in, background 2s ease-in;
}
.back_text {
margin-top: 7%;
text-align: center;
.back:hover
{
border: 4px solid #ffffff;
box-shadow: 0px 0px 50px #fff;
background: rgb(0, 222, 0);
}

View File

@ -0,0 +1,70 @@
.divlog {
margin-left: 10%;
margin-right: auto;
width: 80%;
height: 50%;
margin-top: 35px;
}
.title {
font-size: 3.5vw;
text-align: center;
color: white;
width: auto;
height: auto;
margin-top: 15px;
transition: font-size 0.5s ease-in, text-shadow 1s ease-in;
}
.title:hover {
font-size: 4vw;
text-shadow: 0px 0px 20px #ffffff;
}
input[type=text], input[type=email], input[type=password], input[type=file], input[type=number]{
padding:10px;
border:10;
box-shadow:0 0 15px 4px rgba(0,0,0,0.06);
border-radius:10px;
}
textarea {
width:100%;
resize: vertical;
padding:10px;
border-radius:10px;
border:10;
box-shadow:0 0 15px 4px rgba(0,0,0,0.06);
height:150px;
}
.but {
margin: 40px;
}
.box {
margin-left: 20px;
}
.zag_auth {
margin-left: 20%;
}
#but_log1, #but_log2, #but_log3 {
width: 24%;
}
#but_log2 {
background-color: #16b8f5;
}
#but_log2, #but_log3 {
margin-left: 3%;
}
#divlog {
margin-left: 20%;
}
.back {
margin-top: 5%;
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 22px;
border: 2px solid #ffffff;
width: 20%;
margin-left: 40%;
height: 8%;
font-size: 1.5vw;
}
.back_text {
margin-top: 4%;
text-align: center;
}

View File

@ -0,0 +1,61 @@
.header_title {
font-size: 3.5vw;
text-align: center;
color: white;
width: auto;
height: auto;
margin-top: 15px;
transition: font-size 0.5s ease-in, text-shadow 1s ease-in;
}
.header_title:hover {
font-size: 4vw;
text-shadow: 0px 0px 20px #ffffff;
}
form {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.page, .form-control, .form-label {
width: 70%;
margin-left: 15%;
margin-right: 15%;
}
.box {
margin-left: 20%;
}
.login_form {
width: 70%;
margin-left: 15%;
margin-right: 15%;
display: flex;
flex-flow: column;
}
.buttons_from {
width: 100%;
margin-left: 15%;
display: flex;
justify-content: space-evenly;
flex-wrap: wrap;
}
.button {
margin-top: 5px;
width: auto;
height: auto;
display: flex;
align-self: stretch;
}
.text_button {
margin-top: auto;
width: 90%;
height: 90%;
font-size: 1.2vw;
}
.apk {
width: 40%;
margin-left: 25%;
margin-right: 30%;
}
.text_apk {
text-align: center;
}

View File

@ -49,4 +49,12 @@
}
.button_block {
width: 35%;
}
.apk {
width: 40%;
margin-left: 30%;
margin-right: 30%;
}
.text_apk {
text-align: center;
}

View File

@ -0,0 +1,70 @@
.divlog {
margin-left: 10%;
margin-right: auto;
width: 80%;
height: 50%;
margin-top: 35px;
}
.title {
font-size: 3.5vw;
text-align: center;
color: white;
width: auto;
height: auto;
margin-top: 15px;
transition: font-size 0.5s ease-in, text-shadow 1s ease-in;
}
.title:hover {
font-size: 4vw;
text-shadow: 0px 0px 20px #ffffff;
}
input[type=text], input[type=email], input[type=password], input[type=file], input[type=number]{
padding:10px;
border:10;
box-shadow:0 0 15px 4px rgba(0,0,0,0.06);
border-radius:10px;
}
textarea {
width:100%;
resize: vertical;
padding:10px;
border-radius:10px;
border:10;
box-shadow:0 0 15px 4px rgba(0,0,0,0.06);
height:150px;
}
.but {
margin: 40px;
}
.box {
margin-left: 20px;
}
.zag_auth {
margin-left: 20%;
}
#but_log1, #but_log2, #but_log3 {
width: 24%;
}
#but_log2 {
background-color: #16b8f5;
}
#but_log2, #but_log3 {
margin-left: 3%;
}
#divlog {
margin-left: 20%;
}
.back {
margin-top: 5%;
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 22px;
border: 2px solid #ffffff;
width: 20%;
margin-left: 40%;
height: 8%;
font-size: 1.5vw;
}
.back_text {
margin-top: 4%;
text-align: center;
}

View File

@ -13,9 +13,9 @@
text-align: center;
}
.page {
width: 70%;
margin-left: 15%;
margin-right: 15%;
width: 90%;
margin-left: 5%;
margin-right: 5%;
}
.header_title {
font-size: 2.5vw;
@ -43,7 +43,4 @@
.header_button_text {
text-align: center;
color: #ffffff;
}
body {
margin-bottom: 10%;
}

View File

@ -40,4 +40,7 @@ form {
.back_text {
margin-top: 4%;
text-align: center;
}
.logout_btn {
width: 40%;
}

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 798 KiB

After

Width:  |  Height:  |  Size: 798 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 584 KiB

After

Width:  |  Height:  |  Size: 584 KiB

View File

Before

Width:  |  Height:  |  Size: 411 KiB

After

Width:  |  Height:  |  Size: 411 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 813 KiB

After

Width:  |  Height:  |  Size: 813 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 MiB

After

Width:  |  Height:  |  Size: 4.5 MiB

Some files were not shown because too many files have changed in this diff Show More