Skip to content

Commit

Permalink
Fixed all templates, fixed account_api, fixed werkzeug errors handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mariklolik committed Apr 22, 2020
1 parent 625eb75 commit f190b69
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 19 deletions.
Binary file modified __pycache__/account_api.cpython-37.pyc
Binary file not shown.
Binary file modified __pycache__/main.cpython-37.pyc
Binary file not shown.
9 changes: 6 additions & 3 deletions account_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from flask_login import LoginManager, login_user, logout_user, current_user
from dbremote.db_session import create_session, global_init
from dbremote.user import User, Author
from main import app
from flask import request
import flask
from werkzeug.security import generate_password_hash

Expand All @@ -25,11 +25,11 @@ class LoginForm(FlaskForm):

class RegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
email = StringField('Email', validators=[DataRequired()])
email = StringField('ЭЛЕКТРОМЫЛО', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
password2 = PasswordField(
'Repeat Password', validators=[DataRequired(), EqualTo('password')])
submit = SubmitField('Register')
submit = SubmitField('Done!')


@blueprint.route("/login", methods=["GET", "POST"])
Expand All @@ -56,6 +56,9 @@ def register():
return flask.redirect("/feed")
form = RegistrationForm()
if form.validate_on_submit():
print(form.username.data)
print(form.email.data)
print(form.password.data)
user = User(nickname=form.username.data, email=form.email.data,
hashed_password=generate_password_hash(form.password.data))
# добавить проверку email
Expand Down
Binary file added db/data.sqlite
Binary file not shown.
8 changes: 4 additions & 4 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>stories.ua.kz.ru</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="static/css/main2.css" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/main2.css') }}"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/f755b64f54.js" crossorigin="anonymous"></script>
<!-- <noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript> -->
Expand All @@ -14,7 +14,7 @@
<body class="homepage is-preload">
<!-- NAVBAR -->
<nav class="navbar navbar-light" id='navbar-nav'>
<div class="navbar-in" id='navbar-in'>STO <a href="index.html"><img src="https://img.icons8.com/nolan/64/r.png"></a>IES.RU</div>
<div class="navbar-in" id='navbar-in'>STO <a href="/"><img src="https://img.icons8.com/nolan/64/r.png"></a>IES.RU</div>
</nav>
{% block content %}{% endblock %}

Expand Down Expand Up @@ -45,8 +45,8 @@
</footer>

<!-- Scripts -->
<script src="static/js/jquery.min.js"></script>
<script src="static/js/main2.js"></script>
<script src="{{ url_for('static', filename='/js/jquery.min.js') }}"></script>
<script src="{{ url_for('static', filename='/js/main2.js') }}"></script>
</body>

</html>
4 changes: 2 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ <h2>Чтобы начать - <strong>зарегистрируйся</strong>.</

<!-- Main -->
<div id='#buttons' style="text-align: center; padding: 20%;">
<a href="/login" class="button">Я читаю</a>
<a href="/login" class="button">Я пишу</a>
<a href="/register" class="button">Я читаю</a>
<a href="/register" class="button">Я пишу</a>
<a href="https://pbs.twimg.com/profile_banners/1099372589737230336/1571845396/1500x500" class="button">Я не понимаю </a>
</div>

Expand Down
1 change: 1 addition & 0 deletions templates/login_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<p>
<input type="password" placeholder="Password"></p>
<p><input type="submit" value="Log in" id='button'></p>
<p style="text-align: center;"><a href="/register">I haven't registered yet</a></p>
</form>
</div>
</div>
Expand Down
34 changes: 24 additions & 10 deletions templates/registration_creator.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,44 @@

{% block content %}
<div class="p-x-1 p-y-3" id='registration'>
<form class="card card-block m-x-auto bg-faded form-width">
<form class="card card-block m-x-auto bg-faded form-width" method="post">
{{ form.hidden_tag() }}

<legend class="m-b-1 text-xs-center" id='reg-header'>Creator registration</legend>
<div class="form-group has-float-label">
<span class="form-group has-float-label">
<input class="form-control" id="last" type="text" placeholder="Nickname" name='Nickname' required />
<label for="last">Nickname</label>

{{ form.username.label }}
{{ form.username(class='form-control', size=32, placeholder='mr.kekster') }}
{% for error in form.username.errors %}
<p style="color: red;">[{{ error }}]</p>
{% endfor %}
</span>
</div>
<div class="form-group has-float-label">
<span class="has-float-label">
<input class="form-control" id="email" type="email" placeholder="[email protected]" name='Email' required />
<label for="email">ЭЛЕКТРОМЫЛО</label>
{{ form.email.label }}
{{ form.email(class="form-control", id="email", type="email", placeholder="[email protected]") }}
{% for error in form.email.errors %}
<p style="color: red;">[{{ error }}]</p>
{% endfor %}
</span>
</div>
<div class="form-group has-float-label">
<input class="form-control" id="password" type="password" placeholder="••••••••" required />
<label for="password">Password</label>
{{ form.password.label }}
{{ form.password(class="form-control", id="password", type="password", placeholder="••••••••") }}
{% for error in form.password.errors %}
<p style="color: red;">[{{ error }}]</p>
{% endfor %}
</div>
<div class="form-group has-float-label">
<input class="form-control" id="password2" type="password" placeholder="••••••••" required />
<label for="password">Repeat password</label>
{{ form.password2(class="form-control", id="password", type="password", placeholder="••••••••") }}
{% for error in form.password2.errors %}
<p style="color: red;">[{{ error }}]</p>
{% endfor %}
</div>
<div class="text-xs-center">
<button class="btn btn-block btn-primary" type="submit" id="button-reg">Done!</button>
{{ form.submit(class="btn btn-block btn-primary", id='button-reg') }}
</div>
</form>
</div>
Expand Down

0 comments on commit f190b69

Please sign in to comment.