From c327291cbede73af8fccda29d820986743a5c26d Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 17 Feb 2020 16:14:24 +0100 Subject: [PATCH] Small changes everywhere --- app/__init__.py | 2 +- app/auth/forms.py | 6 +- app/auth/views.py | 14 ++-- app/templates/auth/login.html.j2 | 49 ----------- app/templates/auth/register.html.j2 | 32 ++++---- app/templates/main/index.html.j2 | 123 ++++++++++++++-------------- 6 files changed, 86 insertions(+), 140 deletions(-) delete mode 100644 app/templates/auth/login.html.j2 diff --git a/app/__init__.py b/app/__init__.py index aef0c2b6..cf5442ec 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -10,7 +10,7 @@ import logging db = SQLAlchemy() logger = logging.getLogger(__name__) login_manager = LoginManager() -login_manager.login_view = 'auth.login' +login_manager.login_view = 'main.index' mail = Mail() socketio = SocketIO() diff --git a/app/auth/forms.py b/app/auth/forms.py index b366c05e..7f8d1141 100644 --- a/app/auth/forms.py +++ b/app/auth/forms.py @@ -35,10 +35,8 @@ class RegistrationForm(FlaskForm): email = StringField('Email', validators=[DataRequired(), Email()]) username = StringField( 'Username', - validators=[DataRequired(), - Length(1, 64), - Regexp('^[A-Za-z][A-Za-z0-9_.]*$', - 0, + validators=[DataRequired(), Length(1, 64), + Regexp('^[A-Za-z][A-Za-z0-9_.]*$', 0, 'Usernames must have only letters, numbers, dots ' 'or underscores')] ) diff --git a/app/auth/views.py b/app/auth/views.py index 37f054e7..5ed21377 100644 --- a/app/auth/views.py +++ b/app/auth/views.py @@ -22,15 +22,14 @@ def logout(): def register(): if not current_user.is_anonymous: return redirect(url_for('main.dashboard')) - registration_form = RegistrationForm() + registration_form = RegistrationForm(prefix='registration-form') if registration_form.validate_on_submit(): user = User(email=registration_form.email.data.lower(), password=registration_form.password.data, username=registration_form.username.data) db.session.add(user) db.session.commit() - dir = os.path.join(current_app.config['NOPAQUE_STORAGE'], - str(user.id)) + dir = os.path.join(current_app.config['NOPAQUE_STORAGE'], str(user.id)) try: os.makedirs(dir) except OSError: @@ -41,8 +40,9 @@ def register(): send_email(user.email, 'Confirm Your Account', 'auth/email/confirm', token=token, user=user) flash('A confirmation email has been sent to you by email.') - return redirect(url_for('auth.login')) - return render_template('auth/register.html.j2', form=registration_form, + return redirect(url_for('main.index')) + return render_template('auth/register.html.j2', + registration_form=registration_form, title='Register') @@ -108,7 +108,7 @@ def password_reset_request(): user=user) flash('An email with instructions to reset your password has been ' 'sent to you.') - return redirect(url_for('auth.login')) + return redirect(url_for('main.index')) return render_template('auth/reset_password_request.html.j2', form=form, title='Password Reset') @@ -123,7 +123,7 @@ def password_reset(token): if User.reset_password(token, form.password.data): db.session.commit() flash('Your password has been updated.') - return redirect(url_for('auth.login')) + return redirect(url_for('main.index')) else: return redirect(url_for('main.index')) return render_template('auth/reset_password.html.j2', diff --git a/app/templates/auth/login.html.j2 b/app/templates/auth/login.html.j2 deleted file mode 100644 index 73e4aeac..00000000 --- a/app/templates/auth/login.html.j2 +++ /dev/null @@ -1,49 +0,0 @@ -{% extends "nopaque.html.j2" %} - -{% set full_width = False %} -{% set roadmap = False %} - -{% block page_content %} -
-

New to Opaque?

-

It's free to join and easy to use. Continue on to our registration page to create your Opaque account.

-

Registration -

- -
-
-
-
- {{ form.hidden_tag() }} -
- person - {{ form.login(class='validate', placeholder='Email address or username') }} - {{ form.login.label }} - {% for error in form.login.errors %} - {{ error }} - {% endfor %} -
-
- vpn_key - {{ form.password(class='validate') }} - {{ form.password.label }} - {% for error in form.password.errors %} - {{ error }} - {% endfor %} -
- Forgot your password? -
- -
-
-
- {{ form.submit(class='btn right') }} -
-
-
-
-{% endblock %} diff --git a/app/templates/auth/register.html.j2 b/app/templates/auth/register.html.j2 index 05ee6e0e..c4f3abc5 100644 --- a/app/templates/auth/register.html.j2 +++ b/app/templates/auth/register.html.j2 @@ -5,50 +5,50 @@ {% block page_content %}
-

 

- +

DSGVO

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

- {{ form.hidden_tag() }} + {{ registration_form.hidden_tag() }}
person - {{ form.username(class='validate', data_length='64') }} - {{ form.username.label }} - {% for error in form.username.errors %} + {{ registration_form.username(class='validate', data_length='64') }} + {{ registration_form.username.label }} + {% for error in registration_form.username.errors %} {{ error }} {% endfor %}
vpn_key - {{ form.password(class='validate') }} - {{ form.password.label }} - {% for error in form.password.errors %} + {{ registration_form.password(class='validate') }} + {{ registration_form.password.label }} + {% for error in registration_form.password.errors %} {{ error }} {% endfor %}
vpn_key - {{ form.password2(class='validate') }} - {{ form.password2.label }} - {% for error in form.password2.errors %} + {{ registration_form.password2(class='validate') }} + {{ registration_form.password2.label }} + {% for error in registration_form.password2.errors %} {{ error }} {% endfor %}
email - {{ form.email(class='validate', type='email') }} - {{ form.email.label }} - {% for error in form.email.errors %} + {{ registration_form.email(class='validate', type='email') }} + {{ registration_form.email.label }} + {% for error in registration_form.email.errors %} {{ error }} {% endfor %}
- {{ form.submit(class='btn') }} +
diff --git a/app/templates/main/index.html.j2 b/app/templates/main/index.html.j2 index 672794a2..c45f7f8f 100644 --- a/app/templates/main/index.html.j2 +++ b/app/templates/main/index.html.j2 @@ -7,7 +7,8 @@ {% if current_user.is_anonymous %}

No account?

-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

+

 

person_addRegister
@@ -57,74 +58,70 @@ {% endif %}
-

 

+

 

-
- flash_on -

Speeds up your work

-

All tools provided by nopaque are carefully selected to provide a complete tool suite without delaying compatibility issues.

+
+
+
+ flash_on +

Speeds up your work

+

All tools provided by nopaque are carefully selected to provide a complete tool suite without delaying compatibility issues.

+
+
+ cloud +

Cloud infrastructure

+

All computational work is processed within nopaques cloud infrastructure. You don't need to install any software, great right?

+
+
+ group +

User Experience Focused

+

By utilizing elements and principles of Material Design, we were able to create a framework that focuses on User Experience.

+
+
+ settings +

Easy to work with

+

We have provided detailed documentation as well as specific code examples to help new users get started.

+
+
-
- group -

User Experience Focused

-

By utilizing elements and principles of Material Design, we were able to create a framework that focuses on User Experience.

+ +
+

Processes and Services

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.

-
- settings -

Easy to work with

-

We have provided detailed documentation as well as specific code examples to help new users get started.

+ +
+
+
    +
  • + burst_mode + File setup +

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

    + help +
  • +
  • + find_in_page + Optical Character Recognition +

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

    + help +
  • +
  • + format_textdirection_l_to_r + Natural Language Processing +

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

    + help +
  • +
  • + search + Corpus analysis +

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

    + help +
  • +
-

Processes and Services

-
- -
-
-
-
- burst_mode - File setup

-
-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

-
-
-
- -
-
-
-
- find_in_page - Optical Character Recognition -
-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

-
-
-
- -
-
-
-
- format_textdirection_l_to_r - Natural Language Processing -
-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

-
-
-
- -
-
-
-
- search - Corpus analysis

-
-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

-
-
+

Get things done with nopaque

{% endblock %}