aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorSam2013-08-23 17:38:55 -0500
committerSam2013-08-23 17:38:55 -0500
commitf2e41174a7e2091e7e835b137c6c7e2874feda04 (patch)
treeefb0a2aadd9fb6bf99a801a2a7b8e6141e35edf4 /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')
-rw-r--r--wqflask/flask_security/__init__.py4
-rw-r--r--wqflask/secure_server.py3
-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
5 files changed, 43 insertions, 4 deletions
diff --git a/wqflask/flask_security/__init__.py b/wqflask/flask_security/__init__.py
index 297033c9..81e6c89e 100644
--- a/wqflask/flask_security/__init__.py
+++ b/wqflask/flask_security/__init__.py
@@ -12,8 +12,6 @@
__version__ = '1.6.0'
-print "using internal flask security"
-
from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore
from .decorators import auth_token_required, http_auth_required, \
@@ -23,3 +21,5 @@ from .forms import ForgotPasswordForm, LoginForm, RegisterForm, \
from .signals import confirm_instructions_sent, password_reset, \
reset_password_instructions_sent, user_confirmed, user_registered
from .utils import login_user, logout_user, url_for_security
+
+print "Using our own flask.ext.security" \ No newline at end of file
diff --git a/wqflask/secure_server.py b/wqflask/secure_server.py
index 2abfdb05..04b85663 100644
--- a/wqflask/secure_server.py
+++ b/wqflask/secure_server.py
@@ -25,6 +25,9 @@ app.logger.addHandler(file_handler)
import logging_tree
logging_tree.printout()
+import sys
+print("At startup, path is:", sys.path)
+
#print("app.config is:", app.config)
if __name__ == '__main__':
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>