aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask
diff options
context:
space:
mode:
authorSam2013-08-23 17:38:55 -0500
committerSam2013-08-23 17:38:55 -0500
commitf2e41174a7e2091e7e835b137c6c7e2874feda04 (patch)
treeefb0a2aadd9fb6bf99a801a2a7b8e6141e35edf4 /wqflask/wqflask
parent2138e6b9d91bd3a109e202b9ad2029a737f374e6 (diff)
downloadgenenetwork2-f2e41174a7e2091e7e835b137c6c7e2874feda04.tar.gz
Finally figured out where to put flask_security into the code
Various registration template changes
Diffstat (limited to 'wqflask/wqflask')
-rw-r--r--wqflask/wqflask/model.py14
-rw-r--r--wqflask/wqflask/templates/admin/ind_user_manager.html10
-rw-r--r--wqflask/wqflask/templates/security/register_user.html16
3 files changed, 38 insertions, 2 deletions
diff --git a/wqflask/wqflask/model.py b/wqflask/wqflask/model.py
index 5beba9ff..1f873545 100644
--- a/wqflask/wqflask/model.py
+++ b/wqflask/wqflask/model.py
@@ -3,6 +3,9 @@ from __future__ import print_function, division, absolute_import
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore, UserMixin, RoleMixin
+from flask_security.forms import TextField
+from flask_security.forms import RegisterForm
+
from wqflask import app
# Create database connection object
@@ -46,6 +49,10 @@ class User(db.Model, UserMixin):
id = db.Column(db.Integer(), primary_key=True)
email = db.Column(db.String(255), unique=True)
password = db.Column(db.String(255))
+
+ name = db.Column(db.Unicode(255))
+ organization = db.Column(db.Unicode(255))
+
active = db.Column(db.Boolean())
confirmed_at = db.Column(db.DateTime())
@@ -60,7 +67,12 @@ class User(db.Model, UserMixin):
# Setup Flask-Security
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
-security = Security(app, user_datastore)
+
+class ExtendedRegisterForm(RegisterForm):
+ name = TextField('name')
+ organization = TextField('organization')
+
+security = Security(app, user_datastore, register_form=ExtendedRegisterForm)
db.metadata.create_all(db.engine)
diff --git a/wqflask/wqflask/templates/admin/ind_user_manager.html b/wqflask/wqflask/templates/admin/ind_user_manager.html
index 9776af0b..2fe4a002 100644
--- a/wqflask/wqflask/templates/admin/ind_user_manager.html
+++ b/wqflask/wqflask/templates/admin/ind_user_manager.html
@@ -30,6 +30,16 @@
<th>Value</th>
</tr>
</thead>-->
+
+ <tr>
+ <td>Name</td>
+ <td>{{ user.name }}</td>
+ </tr>
+
+ <tr>
+ <td>Organization</td>
+ <td>{{ user.organization }}</td>
+ </tr>
<tr>
diff --git a/wqflask/wqflask/templates/security/register_user.html b/wqflask/wqflask/templates/security/register_user.html
index 3cd021b0..8e6908ff 100644
--- a/wqflask/wqflask/templates/security/register_user.html
+++ b/wqflask/wqflask/templates/security/register_user.html
@@ -28,8 +28,22 @@
</div>
{{ render_only_errors(register_user_form.email) }}
</div>
+
+ <div class="control-group">
+ <label class="control-label" for="email">Name</label>
+ <div class="controls">
+ <input id="name" name="name" type="text" value="">
+ </div>
+ </div>
<div class="control-group">
+ <label class="control-label" for="email">Organization</label>
+ <div class="controls">
+ <input id="organization" name="organization" type="text" value="">
+ </div>
+ </div>
+
+ <div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
<input id="password" name="password" type="password" value="">
@@ -49,7 +63,7 @@
<div class="control-group">
<div class="controls"">
- <input class="btn btn-primary" id="submit" name="submit" type="submit" value="Sign in">
+ <input class="btn btn-primary" id="submit" name="submit" type="submit" value="Create account">
</div>
</div>