Set up config file. Added style to login.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.idea/
|
||||
py3env/
|
||||
__pycache__/
|
||||
|
||||
cards.db
|
||||
config-personal.txt
|
||||
|
||||
27
README.md
27
README.md
@@ -26,23 +26,16 @@ It uses:
|
||||
|
||||
To Do:
|
||||
|
||||
- [ ] Log in
|
||||
- [ ] Auth
|
||||
- [ ] Auth errors
|
||||
- [ ] Session set
|
||||
- [ ] Logout
|
||||
- [ ] Admin Area
|
||||
- [ ] Admin welcome
|
||||
- [ ] Vocab
|
||||
- [ ] List cards by type
|
||||
- [ ] Add cards
|
||||
- [ ] Edit card
|
||||
- [ ] Delete card
|
||||
- [ ] Code
|
||||
- [ ] List cards by type
|
||||
- [ ] Add cards
|
||||
- [ ] Edit card
|
||||
- [ ] Delete card
|
||||
- [x] Log in
|
||||
- [x] Auth
|
||||
- [x] Auth errors
|
||||
- [x] Session set
|
||||
- [x] Logout
|
||||
- [ ] Card Area
|
||||
- [x] List cards
|
||||
- [x] Add cards
|
||||
- [ ] Edit card
|
||||
- [ ] Delete card
|
||||
- Card Memorization
|
||||
- [ ] Card type toggle
|
||||
- [ ] Show card
|
||||
|
||||
3
config.txt
Normal file
3
config.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
SECRET_KEY='some very long key here'
|
||||
USERNAME='username-here'
|
||||
PASSWORD='password-here'
|
||||
@@ -109,6 +109,7 @@ def login():
|
||||
error = 'Invalid password'
|
||||
else:
|
||||
session['logged_in'] = True
|
||||
session.permanent = True # stay logged in
|
||||
flash('You were logged in')
|
||||
return redirect(url_for('cards'))
|
||||
return render_template('login.html', error=error)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
{% if session.logged_in %}
|
||||
<form action="{{ url_for('add_card') }}" method=post class=add-card>
|
||||
|
||||
<div class="well">
|
||||
<h2>Add a Card</h2>
|
||||
<form action="{{ url_for('add_card') }}" method=post class=add-card>
|
||||
<div class="form-group">
|
||||
<label for="type">Type</label>
|
||||
<label for="general" class="toggleButton btn btn-default btn-lg">General
|
||||
<input type="radio" name="type" value="1" id="general"/>
|
||||
</label>
|
||||
@@ -28,9 +28,7 @@
|
||||
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h2>{{ cards|length }} Card{{ '' if (cards|length == 1) else 's' }}</h2>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<p>
|
||||
Well, hello there.
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<h2>Login</h2>
|
||||
{% if error %}<div class="alert alert-danger" role="alert">{{ error }}</div>{% endif %}
|
||||
<form action="{{ url_for('login') }}" method=post>
|
||||
<dl>
|
||||
<dt>Username:
|
||||
<dd><input type=text name=username>
|
||||
<dt>Password:
|
||||
<dd><input type=password name=password>
|
||||
<dd><input type=submit value="Log in">
|
||||
</dl>
|
||||
</form>
|
||||
<h2>Login</h2>
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">{{ error }}</div>{% endif %}
|
||||
|
||||
<div class="well">
|
||||
<form action="{{ url_for('login') }}" method=post>
|
||||
<div class="form-group">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" name="username" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-lg btn-primary">Log in</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user