working login form from html. needs refactoring
This commit is contained in:
parent
8738ad8e36
commit
eb49417935
|
@ -52,8 +52,8 @@ app.register_blueprint(panel_blueprint, url_prefix='/panel')
|
|||
from .auth import auth as auth_blueprint
|
||||
app.register_blueprint(auth_blueprint, url_prefix='/auth')
|
||||
|
||||
from .news import news as news_blueprint
|
||||
app.register_blueprint(news_blueprint, url_prefix='/news')
|
||||
#from .news import news as news_blueprint
|
||||
#app.register_blueprint(news_blueprint, url_prefix='/news')
|
||||
|
||||
from .admin import admin as admin_blueprint
|
||||
app.register_blueprint(admin_blueprint, url_prefix='/' + app.config['ADMIN_PREFIX'])
|
||||
|
|
26
app/main/forms.py
Normal file
26
app/main/forms.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from flask_wtf import FlaskForm, RecaptchaField
|
||||
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField
|
||||
from wtforms import validators, ValidationError
|
||||
from wtforms.fields.html5 import EmailField
|
||||
from ..models import User
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
email = EmailField('', [validators.DataRequired(), validators.Length(1,64), validators.Email()], render_kw={"placeholder": "username"})
|
||||
password = PasswordField('', [validators.DataRequired(), validators.Length(1,128)], render_kw={"placeholder": "password"})
|
||||
remember_me = BooleanField('Remember?', render_kw={"placeholder": "remember"})
|
||||
#recaptcha = RecaptchaField()
|
||||
submit = SubmitField('Login', render_kw={"placeholder": "submit"})
|
||||
|
||||
class RegistrationForm(FlaskForm):
|
||||
email = StringField('E-Mail', [validators.DataRequired(), validators.Length(6,35), validators.Email()])
|
||||
def validate_email(self, field):
|
||||
if User.query.filter_by(email=field.data).first():
|
||||
raise ValidationError('Error. Please try again.')
|
||||
password = PasswordField('Password', [validators.DataRequired(), validators.EqualTo('confirm', message='Both passwords must be equal')])
|
||||
confirm = PasswordField('Your password again', [validators.DataRequired()])
|
||||
accept_tos = BooleanField('I accept the <a href="/terms">Terms of Service</a>', [validators.DataRequired()])
|
||||
recaptcha = RecaptchaField()
|
||||
submit = SubmitField('REGISTER')
|
||||
|
|
@ -3,6 +3,7 @@ from flask_login import login_required, login_user, logout_user, current_user
|
|||
from flask_sqlalchemy import get_debug_queries
|
||||
|
||||
from . import main
|
||||
from .forms import LoginForm, RegistrationForm
|
||||
from .. import db
|
||||
from ..email import send_email
|
||||
from ..models import User, Permission, Server, Deployment, Service, Region, Address, Domain, contact_proxmaster
|
||||
|
@ -19,8 +20,9 @@ def after_request(response):
|
|||
#STATIC PAGES
|
||||
@main.route("/", methods=['GET'])
|
||||
def index():
|
||||
form = LoginForm()
|
||||
allservers = Server.query.filter_by(enabled=True)
|
||||
return render_template('main/index.html', servers=allservers)
|
||||
return render_template('main/index.html', servers=allservers, form=form)
|
||||
|
||||
@main.route("/chat", methods=['GET'])
|
||||
def chat():
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
.panel-transparent .panel-heading {
|
||||
background: rgb(255, 255, 255); /* fallback */
|
||||
background: rgba(255, 255, 255, 0.7)!important;
|
||||
background: rgba(255, 255, 255, 0.6)!important;
|
||||
}
|
||||
|
||||
.panel-transparent .panel-body{
|
||||
background: rgb(255, 255, 255); /* fallback */
|
||||
background: rgba(255, 255, 255, 0.7)!important;
|
||||
background: rgba(255, 255, 255, 0.5)!important;
|
||||
}
|
||||
|
|
|
@ -74,19 +74,21 @@
|
|||
|
||||
<div class="panel-body">
|
||||
<div class="form">
|
||||
<form class="register-form">
|
||||
<form class="register-form" actoion="{{ url_for('auth.register') }}" method="POST">
|
||||
<input type="text" placeholder="name"/>
|
||||
<input type="password" placeholder="password"/>
|
||||
<input type="text" placeholder="email address"/>
|
||||
<button>create</button>
|
||||
<p class="message">Already registered? <a href="#">Sign In</a></p>
|
||||
</form>
|
||||
<form class="login-form">
|
||||
<input type="text" placeholder="username"/>
|
||||
<input type="password" placeholder="password"/>
|
||||
<button>login</button>
|
||||
<p class="message">Not registered? <a href="#">Create an account</a></p>
|
||||
</form>
|
||||
<form class="login-form" action="{{ url_for('auth.login') }}" method="POST">
|
||||
<input name="email" type="text" placeholder="username"/>
|
||||
<input name="password" type="password" placeholder="password"/>
|
||||
<input name="remember_me" type="checkbox"/>
|
||||
{{ form.csrf_token }}
|
||||
<button name="submit">login</button>
|
||||
<p class="message">Not registered? <a href="#">Create an account</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -97,7 +99,7 @@
|
|||
|
||||
<div class="container-fluid-index">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5 col-md-offset-1">
|
||||
<div class="panel panel-primary panel-transparent">
|
||||
<div class="panel-body">
|
||||
<img src="../../static/images/VPS-equipment.png" width="64" height="64" />
|
||||
|
@ -112,12 +114,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5 col-md-offset-0">
|
||||
<div class="panel panel-primary panel-transparent">
|
||||
<div class="panel-body">
|
||||
<img src="../../static/images/VPS-Mission.png" width="64" height="64" />
|
||||
<h2 class="media-heading">Мисия</h2>
|
||||
<p>Предоставяме платформа за управление на Вашите изчислителни процеси,</p>
|
||||
<p><img src="../../static/images/VPS-Mission.png" width="64" height="64" align="top"><h2 class="media-heading">Мисия</h2></p>
|
||||
<p>Предоставяме платформа за управление на Вашите изчислителни процеси</p>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<img src="../../static/images/VPS-Support.png" width="64" height="64" />
|
||||
|
|
Loading…
Reference in a new issue