From 3fd3f8f312240aebeb5df23c6bc85eb0c001546c Mon Sep 17 00:00:00 2001 From: Peter Shin Date: Fri, 26 Oct 2018 16:59:10 -0400 Subject: [PATCH 1/3] HTML, CSS, JSON HTML page templates, CSS files, and JSON file for testing with data --- launchpad/static/Projects.json | 28 +++++++++ launchpad/static/Style.css | 9 +++ launchpad/static/main.css | 80 +++++++++++++++++++++++++ launchpad/templates/about.html | 4 ++ launchpad/templates/home.html | 15 +++++ launchpad/templates/layout.html | 74 +++++++++++++++++++++++ launchpad/templates/login.html | 0 launchpad/templates/myprojects.html | 50 ++++++++++++++++ launchpad/templates/project_layout.html | 5 ++ launchpad/templates/register.html | 34 +++++++++++ 10 files changed, 299 insertions(+) create mode 100644 launchpad/static/Projects.json create mode 100644 launchpad/static/Style.css create mode 100644 launchpad/static/main.css create mode 100644 launchpad/templates/about.html create mode 100644 launchpad/templates/home.html create mode 100644 launchpad/templates/layout.html create mode 100644 launchpad/templates/login.html create mode 100644 launchpad/templates/myprojects.html create mode 100644 launchpad/templates/project_layout.html create mode 100644 launchpad/templates/register.html diff --git a/launchpad/static/Projects.json b/launchpad/static/Projects.json new file mode 100644 index 0000000..0891531 --- /dev/null +++ b/launchpad/static/Projects.json @@ -0,0 +1,28 @@ +{ + "projects": [ + { + "lang": "python", + "level": 1, + "description": "Get started with this beginner Python project!" + }, + { + "lang": "java", + "level": 2, + "description": "Try this fun Java project!" + }, + { + "lang": "c++", + "level": 2, + "description": "Try your skills with this great C++ project!" + }, + { + "lang": "reactjs", + "level": 3, + "description": "Challenge yourself with this level 3 JavaScript library!" + } + + ], + + "dataTitle": "Projects", + "version": 1.0 +} diff --git a/launchpad/static/Style.css b/launchpad/static/Style.css new file mode 100644 index 0000000..f982fad --- /dev/null +++ b/launchpad/static/Style.css @@ -0,0 +1,9 @@ +.container{ + margin-left: 8%; +} + +.card:hover{ + -webkit-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); + -moz-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); + box-shadow: -1px 9px 40px -12px rgba(0, 0, 0, 0.75); +} diff --git a/launchpad/static/main.css b/launchpad/static/main.css new file mode 100644 index 0000000..e0d28e6 --- /dev/null +++ b/launchpad/static/main.css @@ -0,0 +1,80 @@ +body { + background: #fafafa; + color: #333333; + margin-top: 5rem; +} + +h1, h2, h3, h4, h5, h6 { + color: #444444; +} + +.bg-steel { + background-color: #5f788a; +} + +.site-header .navbar-nav .nav-link { + color: #cbd5db; +} + +.site-header .navbar-nav .nav-link:hover { + color: #ffffff; +} + +.site-header .navbar-nav .nav-link.active { + font-weight: 500; +} + +.content-section { + background: #ffffff; + padding: 10px 20px; + border: 1px solid #dddddd; + border-radius: 3px; + margin-bottom: 20px; +} + +.article-title { + color: #444444; +} + +a.article-title:hover { + color: #428bca; + text-decoration: none; +} + +.article-content { + white-space: pre-line; +} + +.article-img { + height: 65px; + width: 65px; + margin-right: 16px; +} + +.article-metadata { + padding-bottom: 1px; + margin-bottom: 4px; + border-bottom: 1px solid #e3e3e3 +} + +.article-metadata a:hover { + color: #333; + text-decoration: none; +} + +.article-svg { + width: 25px; + height: 25px; + vertical-align: middle; +} + +.account-img { + height: 125px; + width: 125px; + margin-right: 20px; + margin-bottom: 16px; +} + +.account-heading { + font-size: 2.5rem; +} \ No newline at end of file diff --git a/launchpad/templates/about.html b/launchpad/templates/about.html new file mode 100644 index 0000000..46d6f62 --- /dev/null +++ b/launchpad/templates/about.html @@ -0,0 +1,4 @@ +{% extends "layout.html" %} +{% block content %} +

About Page

+{% endblock content%} \ No newline at end of file diff --git a/launchpad/templates/home.html b/launchpad/templates/home.html new file mode 100644 index 0000000..779250b --- /dev/null +++ b/launchpad/templates/home.html @@ -0,0 +1,15 @@ +{% extends "layout.html" %} +{% block content %} + {% for post in posts %} +
+
+ +

{{ post.title }}

+

{{ post.content }}

+
+
+ {% endfor %} +{% endblock content%} diff --git a/launchpad/templates/layout.html b/launchpad/templates/layout.html new file mode 100644 index 0000000..a24122b --- /dev/null +++ b/launchpad/templates/layout.html @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + {% if title %} + coding&&community - {{ title }} + {% else %} + coding&&community + {% endif %} + + + + + +
+
+
+ {%with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
+ {{message}} +
+ {% endfor %} + {% endif%} + {% endwith %} +
+
+ {% block content %}{% endblock %} + +
+ + + + + + + + + + + diff --git a/launchpad/templates/login.html b/launchpad/templates/login.html new file mode 100644 index 0000000..e69de29 diff --git a/launchpad/templates/myprojects.html b/launchpad/templates/myprojects.html new file mode 100644 index 0000000..268b466 --- /dev/null +++ b/launchpad/templates/myprojects.html @@ -0,0 +1,50 @@ +{% extends "layout.html" %} +{% block content %} +

My Projects

+
+
+
+ +
+
+ + +{% endblock content%} diff --git a/launchpad/templates/project_layout.html b/launchpad/templates/project_layout.html new file mode 100644 index 0000000..3262698 --- /dev/null +++ b/launchpad/templates/project_layout.html @@ -0,0 +1,5 @@ +{% extends "layout.html" %} +{% block content %} + + +{% endblock content%} diff --git a/launchpad/templates/register.html b/launchpad/templates/register.html new file mode 100644 index 0000000..75d74a9 --- /dev/null +++ b/launchpad/templates/register.html @@ -0,0 +1,34 @@ +{% extends "layout.html" %} +{% block content %} +
+
+ {{ form.hidden_tag() }} +
+
+ {{ form.username.label(class="form-control-label") }} + {{ form.username(class="form-control form-control-lg") }} +
+
+ {{ form.email.label(class="form-control-label") }} + {{ form.email(class="form-control form-control-lg") }} +
+
+ {{ form.password.label(class="form-control-label") }} + {{ form.password(class="form-control form-control-lg") }} +
+
+ {{ form.confirm_password.label(class="form-control-label") }} + {{ form.confirm_password(class="form-control form-control-lg") }} +
+
+
+ {{ form.submit(class="btn btn-outline-info") }} +
+
+
+
+ + Already Have An Account? Sign In + +{% endblock content%} \ No newline at end of file From e4c71ff491f7be6734fa4528d255f689600f0e21 Mon Sep 17 00:00:00 2001 From: pjs1221 Date: Fri, 26 Oct 2018 17:02:46 -0400 Subject: [PATCH 2/3] HTML page templates, CSS files, and JSON file for testing with data --- .gitignore | 4 +- LICENSE | 42 +++---- README.md | 58 ++++----- launchpad/__init__.py | 14 +-- launchpad/api.py | 14 +-- launchpad/explorer.py | 22 ++-- launchpad/static/Projects.json | 56 ++++----- launchpad/static/Style.css | 18 +-- launchpad/static/main.css | 158 ++++++++++++------------ launchpad/templates/about.html | 6 +- launchpad/templates/home.html | 30 ++--- launchpad/templates/layout.html | 148 +++++++++++----------- launchpad/templates/myprojects.html | 100 +++++++-------- launchpad/templates/project_layout.html | 10 +- launchpad/templates/register.html | 66 +++++----- setup.py | 20 +-- 16 files changed, 383 insertions(+), 383 deletions(-) diff --git a/.gitignore b/.gitignore index f650bce..43bbf53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -venv -*.egg-info +venv +*.egg-info diff --git a/LICENSE b/LICENSE index 5b715ef..876ea42 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2018 coding&&community - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2018 coding&&community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 99fa83e..2b7fbe7 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -# Launchpad -The website for students to access coding&&community curriculums online. - -## Setup -Setup the virtual environment. -``` -python3 -m venv venv -``` -Every time you work on the project, start up venv: -``` -. venv/bin/activate -``` -Install Flask: -``` -pip install Flask -``` -Windows instructions at http://flask.pocoo.org/docs/1.0/installation/#installation - -## Running for the first time -``` -export FLASK_APP=launchpad -pip install -e . -flask run -``` -Then go to your web browser, and navigate to http://localhost:5000 - -Instructions may be different on Windows. - - +# Launchpad +The website for students to access coding&&community curriculums online. + +## Setup +Setup the virtual environment. +``` +python3 -m venv venv +``` +Every time you work on the project, start up venv: +``` +. venv/bin/activate +``` +Install Flask: +``` +pip install Flask +``` +Windows instructions at http://flask.pocoo.org/docs/1.0/installation/#installation + +## Running for the first time +``` +export FLASK_APP=launchpad +pip install -e . +flask run +``` +Then go to your web browser, and navigate to http://localhost:5000 + +Instructions may be different on Windows. + + diff --git a/launchpad/__init__.py b/launchpad/__init__.py index 320e9b3..33de093 100644 --- a/launchpad/__init__.py +++ b/launchpad/__init__.py @@ -1,7 +1,7 @@ -from flask import Flask -from launchpad.api import launchpad_api -from launchpad.explorer import explorer - -app = Flask(__name__) -app.register_blueprint(launchpad_api, url_prefix='/api') -app.register_blueprint(explorer) +from flask import Flask +from launchpad.api import launchpad_api +from launchpad.explorer import explorer + +app = Flask(__name__) +app.register_blueprint(launchpad_api, url_prefix='/api') +app.register_blueprint(explorer) diff --git a/launchpad/api.py b/launchpad/api.py index 12dcebf..f3dfee2 100644 --- a/launchpad/api.py +++ b/launchpad/api.py @@ -1,7 +1,7 @@ -from flask import Blueprint - -launchpad_api = Blueprint('launchpad_api', __name__, template_folder='templates') - -@launchpad_api.route('/test') -def test(): - return 'API test' +from flask import Blueprint + +launchpad_api = Blueprint('launchpad_api', __name__, template_folder='templates') + +@launchpad_api.route('/test') +def test(): + return 'API test' diff --git a/launchpad/explorer.py b/launchpad/explorer.py index d953349..7e5b99b 100644 --- a/launchpad/explorer.py +++ b/launchpad/explorer.py @@ -1,11 +1,11 @@ -from flask import Blueprint - -explorer = Blueprint('explorer', __name__, template_folder='templates') - -@explorer.route('/') -def index(): - return 'Explorer index' - -@explorer.route('/test') -def test(): - return 'Explorer test' +from flask import Blueprint + +explorer = Blueprint('explorer', __name__, template_folder='templates') + +@explorer.route('/') +def index(): + return 'Explorer index' + +@explorer.route('/test') +def test(): + return 'Explorer test' diff --git a/launchpad/static/Projects.json b/launchpad/static/Projects.json index 0891531..fc45419 100644 --- a/launchpad/static/Projects.json +++ b/launchpad/static/Projects.json @@ -1,28 +1,28 @@ -{ - "projects": [ - { - "lang": "python", - "level": 1, - "description": "Get started with this beginner Python project!" - }, - { - "lang": "java", - "level": 2, - "description": "Try this fun Java project!" - }, - { - "lang": "c++", - "level": 2, - "description": "Try your skills with this great C++ project!" - }, - { - "lang": "reactjs", - "level": 3, - "description": "Challenge yourself with this level 3 JavaScript library!" - } - - ], - - "dataTitle": "Projects", - "version": 1.0 -} +{ + "projects": [ + { + "lang": "python", + "level": 1, + "description": "Get started with this beginner Python project!" + }, + { + "lang": "java", + "level": 2, + "description": "Try this fun Java project!" + }, + { + "lang": "c++", + "level": 2, + "description": "Try your skills with this great C++ project!" + }, + { + "lang": "reactjs", + "level": 3, + "description": "Challenge yourself with this level 3 JavaScript library!" + } + + ], + + "dataTitle": "Projects", + "version": 1.0 +} diff --git a/launchpad/static/Style.css b/launchpad/static/Style.css index f982fad..13a939c 100644 --- a/launchpad/static/Style.css +++ b/launchpad/static/Style.css @@ -1,9 +1,9 @@ -.container{ - margin-left: 8%; -} - -.card:hover{ - -webkit-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); - -moz-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); - box-shadow: -1px 9px 40px -12px rgba(0, 0, 0, 0.75); -} +.container{ + margin-left: 8%; +} + +.card:hover{ + -webkit-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); + -moz-box-shadow: -1px 9px 40px -12px rgba(0,0,0,0.75); + box-shadow: -1px 9px 40px -12px rgba(0, 0, 0, 0.75); +} diff --git a/launchpad/static/main.css b/launchpad/static/main.css index e0d28e6..e321ab1 100644 --- a/launchpad/static/main.css +++ b/launchpad/static/main.css @@ -1,80 +1,80 @@ -body { - background: #fafafa; - color: #333333; - margin-top: 5rem; -} - -h1, h2, h3, h4, h5, h6 { - color: #444444; -} - -.bg-steel { - background-color: #5f788a; -} - -.site-header .navbar-nav .nav-link { - color: #cbd5db; -} - -.site-header .navbar-nav .nav-link:hover { - color: #ffffff; -} - -.site-header .navbar-nav .nav-link.active { - font-weight: 500; -} - -.content-section { - background: #ffffff; - padding: 10px 20px; - border: 1px solid #dddddd; - border-radius: 3px; - margin-bottom: 20px; -} - -.article-title { - color: #444444; -} - -a.article-title:hover { - color: #428bca; - text-decoration: none; -} - -.article-content { - white-space: pre-line; -} - -.article-img { - height: 65px; - width: 65px; - margin-right: 16px; -} - -.article-metadata { - padding-bottom: 1px; - margin-bottom: 4px; - border-bottom: 1px solid #e3e3e3 -} - -.article-metadata a:hover { - color: #333; - text-decoration: none; -} - -.article-svg { - width: 25px; - height: 25px; - vertical-align: middle; -} - -.account-img { - height: 125px; - width: 125px; - margin-right: 20px; - margin-bottom: 16px; -} - -.account-heading { - font-size: 2.5rem; +body { + background: #fafafa; + color: #333333; + margin-top: 5rem; +} + +h1, h2, h3, h4, h5, h6 { + color: #444444; +} + +.bg-steel { + background-color: #5f788a; +} + +.site-header .navbar-nav .nav-link { + color: #cbd5db; +} + +.site-header .navbar-nav .nav-link:hover { + color: #ffffff; +} + +.site-header .navbar-nav .nav-link.active { + font-weight: 500; +} + +.content-section { + background: #ffffff; + padding: 10px 20px; + border: 1px solid #dddddd; + border-radius: 3px; + margin-bottom: 20px; +} + +.article-title { + color: #444444; +} + +a.article-title:hover { + color: #428bca; + text-decoration: none; +} + +.article-content { + white-space: pre-line; +} + +.article-img { + height: 65px; + width: 65px; + margin-right: 16px; +} + +.article-metadata { + padding-bottom: 1px; + margin-bottom: 4px; + border-bottom: 1px solid #e3e3e3 +} + +.article-metadata a:hover { + color: #333; + text-decoration: none; +} + +.article-svg { + width: 25px; + height: 25px; + vertical-align: middle; +} + +.account-img { + height: 125px; + width: 125px; + margin-right: 20px; + margin-bottom: 16px; +} + +.account-heading { + font-size: 2.5rem; } \ No newline at end of file diff --git a/launchpad/templates/about.html b/launchpad/templates/about.html index 46d6f62..36ae6e6 100644 --- a/launchpad/templates/about.html +++ b/launchpad/templates/about.html @@ -1,4 +1,4 @@ -{% extends "layout.html" %} -{% block content %} -

About Page

+{% extends "layout.html" %} +{% block content %} +

About Page

{% endblock content%} \ No newline at end of file diff --git a/launchpad/templates/home.html b/launchpad/templates/home.html index 779250b..e51cf9d 100644 --- a/launchpad/templates/home.html +++ b/launchpad/templates/home.html @@ -1,15 +1,15 @@ -{% extends "layout.html" %} -{% block content %} - {% for post in posts %} - - {% endfor %} -{% endblock content%} +{% extends "layout.html" %} +{% block content %} + {% for post in posts %} + + {% endfor %} +{% endblock content%} diff --git a/launchpad/templates/layout.html b/launchpad/templates/layout.html index a24122b..1ec5b21 100644 --- a/launchpad/templates/layout.html +++ b/launchpad/templates/layout.html @@ -1,74 +1,74 @@ - - - - - - - - - - - - - - - {% if title %} - coding&&community - {{ title }} - {% else %} - coding&&community - {% endif %} - - - - - -
-
-
- {%with messages = get_flashed_messages(with_categories=true) %} - {% if messages %} - {% for category, message in messages %} -
- {{message}} -
- {% endfor %} - {% endif%} - {% endwith %} -
-
- {% block content %}{% endblock %} - -
- - - - - - - - - - - + + + + + + + + + + + + + + + {% if title %} + coding&&community - {{ title }} + {% else %} + coding&&community + {% endif %} + + + + + +
+
+
+ {%with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
+ {{message}} +
+ {% endfor %} + {% endif%} + {% endwith %} +
+
+ {% block content %}{% endblock %} + +
+ + + + + + + + + + + diff --git a/launchpad/templates/myprojects.html b/launchpad/templates/myprojects.html index 268b466..be9e3f3 100644 --- a/launchpad/templates/myprojects.html +++ b/launchpad/templates/myprojects.html @@ -1,50 +1,50 @@ -{% extends "layout.html" %} -{% block content %} -

My Projects

-
-
-
- -
-
- - -{% endblock content%} +{% extends "layout.html" %} +{% block content %} +

My Projects

+
+
+
+ +
+
+ + +{% endblock content%} diff --git a/launchpad/templates/project_layout.html b/launchpad/templates/project_layout.html index 3262698..affb845 100644 --- a/launchpad/templates/project_layout.html +++ b/launchpad/templates/project_layout.html @@ -1,5 +1,5 @@ -{% extends "layout.html" %} -{% block content %} - - -{% endblock content%} +{% extends "layout.html" %} +{% block content %} + + +{% endblock content%} diff --git a/launchpad/templates/register.html b/launchpad/templates/register.html index 75d74a9..a52ec6e 100644 --- a/launchpad/templates/register.html +++ b/launchpad/templates/register.html @@ -1,34 +1,34 @@ -{% extends "layout.html" %} -{% block content %} -
-
- {{ form.hidden_tag() }} -
-
- {{ form.username.label(class="form-control-label") }} - {{ form.username(class="form-control form-control-lg") }} -
-
- {{ form.email.label(class="form-control-label") }} - {{ form.email(class="form-control form-control-lg") }} -
-
- {{ form.password.label(class="form-control-label") }} - {{ form.password(class="form-control form-control-lg") }} -
-
- {{ form.confirm_password.label(class="form-control-label") }} - {{ form.confirm_password(class="form-control form-control-lg") }} -
-
-
- {{ form.submit(class="btn btn-outline-info") }} -
-
-
-
- - Already Have An Account? Sign In - +{% extends "layout.html" %} +{% block content %} +
+
+ {{ form.hidden_tag() }} +
+
+ {{ form.username.label(class="form-control-label") }} + {{ form.username(class="form-control form-control-lg") }} +
+
+ {{ form.email.label(class="form-control-label") }} + {{ form.email(class="form-control form-control-lg") }} +
+
+ {{ form.password.label(class="form-control-label") }} + {{ form.password(class="form-control form-control-lg") }} +
+
+ {{ form.confirm_password.label(class="form-control-label") }} + {{ form.confirm_password(class="form-control form-control-lg") }} +
+
+
+ {{ form.submit(class="btn btn-outline-info") }} +
+
+
+
+ + Already Have An Account? Sign In + {% endblock content%} \ No newline at end of file diff --git a/setup.py b/setup.py index cc2be7c..6321db3 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ -from setuptools import setup - -setup( - name='launchpad', - packages=['launchpad'], - include_package_data=True, - install_requires=[ - 'flask', - ], -) +from setuptools import setup + +setup( + name='launchpad', + packages=['launchpad'], + include_package_data=True, + install_requires=[ + 'flask', + ], +) From a29dce3eae80e3eaee95c462f05face8d406e13e Mon Sep 17 00:00:00 2001 From: pjs1221 Date: Sat, 27 Oct 2018 15:53:26 -0400 Subject: [PATCH 3/3] Flask python files --- launchpad/forms.py | 17 ++++++++++++++++ launchpad/oscp.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 launchpad/forms.py create mode 100644 launchpad/oscp.py diff --git a/launchpad/forms.py b/launchpad/forms.py new file mode 100644 index 0000000..a218359 --- /dev/null +++ b/launchpad/forms.py @@ -0,0 +1,17 @@ +from flask_wtf import FlaskForm +from wtforms import StringField, PasswordField, SubmitField, BooleanField +from wtforms.validators import DataRequired, Length, Email, EqualTo + +class RegistrationForm(FlaskForm): + username = StringField('Username', validators=[DataRequired(), Length(min=2, max=20)]) + email = StringField('Email', validators=[DataRequired(), Email()]) + password = PasswordField('Password',validators=[DataRequired()]) + confirm_password = PasswordField('Confirm Password',validators=[DataRequired(), EqualTo('password')]) + submit = SubmitField('Sign Up') + +class LoginForm(FlaskForm): + email = StringField('Email', validators=[DataRequired(), Email()]) + password = PasswordField('Password',validators=[DataRequired()]) + remember = BooleanField('Remember Me') + submit = SubmitField('Login') + \ No newline at end of file diff --git a/launchpad/oscp.py b/launchpad/oscp.py new file mode 100644 index 0000000..3ffeb0b --- /dev/null +++ b/launchpad/oscp.py @@ -0,0 +1,51 @@ +from flask import Flask, render_template, url_for, flash, redirect +from forms import RegistrationForm, LoginForm +app = Flask(__name__) + +app.config['SECRET_KEY'] = '\xa4>\xb5\xd3m\xcb\r\xb2\xf93\xd1\xc1~\x8bQ\xe4' + +posts = [ + { + 'author': 'Jane Doe', + 'title': 'Blog Post 2', + 'content': 'Need help with...', + 'date_posted': 'September 30, 2018' + }, + { + 'author': 'John Smith', + 'title': 'test post', + 'content': 'Second post content', + 'date_posted': 'September 1, 2018' + } +] + + +@app.route("/") +@app.route("/home") +def home(): + return render_template("home.html",posts=posts) + +@app.route("/about") +def about(): + return render_template("about.html",title='About') + +@app.route("/myprojects") +def myprojects(): + return render_template("myprojects.html",title='My Projects') + +@app.route("/register", methods=['GET','POST']) +def register(): + form = RegistrationForm() + if form.validate_on_submit(): + flash(f'Account created for {form.username.data}!', 'success') + return redirect(url_for('home')) + return render_template('register.html', title = 'Register', form=form) + +@app.route("/login") +def login(): + form = LoginForm() + return render_template('login.html', title = 'Login', form=form) + + +if __name__ == '__main__': + app.run(debug=True)