aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam2013-05-09 22:28:22 +0000
committerSam2013-05-09 22:28:22 +0000
commit1cf6894c7416f879fcd114ae7358bb7d4169a677 (patch)
tree457768e0ea50ac9811c981cfdb6728b2da317896
parenteddd1badf9b1c84e16f9e461ee9920554ebd8c5a (diff)
downloadgenenetwork2-1cf6894c7416f879fcd114ae7358bb7d4169a677.tar.gz
Working on user registration
-rw-r--r--wqflask/secure_server.py9
-rw-r--r--wqflask/wqflask/templates/base.html30
-rw-r--r--wqflask/wqflask/templates/index_page.html7
-rw-r--r--wqflask/wqflask/templates/security/register_user.html40
4 files changed, 39 insertions, 47 deletions
diff --git a/wqflask/secure_server.py b/wqflask/secure_server.py
index 5448dbeb..60f6db44 100644
--- a/wqflask/secure_server.py
+++ b/wqflask/secure_server.py
@@ -7,6 +7,11 @@ from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore, UserMixin, RoleMixin
+# Setup mail
+from flask.ext.mail import Mail
+mail = Mail(app)
+
+
# Create database connection object
db = SQLAlchemy(app)
@@ -26,13 +31,13 @@ class User(db.Model, UserMixin):
password = db.Column(db.String(255))
active = db.Column(db.Boolean())
confirmed_at = db.Column(db.DateTime())
-
+
last_login_at = db.Column(db.DateTime())
current_login_at = db.Column(db.DateTime())
last_login_ip_= db.Column(db.String(39))
current_login_ip = db.Column(db.String(39))
login_count = db.Column(db.Integer())
-
+
roles = db.relationship('Role', secondary=roles_users,
backref=db.backref('users', lazy='dynamic'))
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 71c12941..6f4b8e1e 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -14,9 +14,9 @@
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
-
+
{% block css %}
{% endblock %}
@@ -57,13 +57,17 @@
<a href="/whats_new">News</a>
</li>
<li class="">
- <a href="./reference.html">References</a>
+ <a href="/reference">References</a>
+ </li>
+ <li class="">
+ <a href="/policies">Policies</a>
</li>
<li class="">
- <a href="./policies">Policies</a>
+ <a href="/links">Links</a>
</li>
<li class="">
- <a href="./links">Links</a>
+ <a href="/register" data-remote="/register"
+ data-target="#utility" data-toggle="modal">Login</a>
</li>
</ul>
</div>
@@ -137,6 +141,22 @@
</div>
</footer>
+ <!--http://stackoverflow.com/questions/14045515/how-can-i-reuse-one-bootstrap-modal-div-->
+ <!-- Modal -->
+ <div id="utility" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h3 id="myModalLabel">Click outside modal to close it</h3>
+ </div>
+ <div class="modal-body">
+ <p>One fine body…this is getting replaced with content that comes from passed-in href</p>
+ </div>
+ <div class="modal-footer">
+ <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
+ <button class="btn btn-primary">Save changes</button>
+ </div>
+ </div>
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="/static/packages/bootstrap/js/bootstrap.min.js"></script>
<script>
diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html
index 0cc1c353..5c88c923 100644
--- a/wqflask/wqflask/templates/index_page.html
+++ b/wqflask/wqflask/templates/index_page.html
@@ -9,7 +9,6 @@
<div class="container">
<h1>GeneNetwork</h1>
<p class="lead">Open source bioinformatics for systems genetics</p>
- <p>- Lei Yan</p>
</div>
</header>
@@ -38,16 +37,16 @@
<input class="input-xlarge"
id="quick" name="q"
type="text" maxlength="500">
-
+
<input id="btsearch" type="submit"
class="btn btn-primary" value="Search">
</div>
</fieldset>
-
+
</form>
</section>
<section id="search">
-
+
<div class="page-header">
<h1>Select and search</h1>
</div>
diff --git a/wqflask/wqflask/templates/security/register_user.html b/wqflask/wqflask/templates/security/register_user.html
index af87f810..87cf9b1d 100644
--- a/wqflask/wqflask/templates/security/register_user.html
+++ b/wqflask/wqflask/templates/security/register_user.html
@@ -1,40 +1,7 @@
{% from "security/_macros.html" import render_field_with_errors, render_field %}
-{% extends "base.html" %}
{% include "security/_messages.html" %}
-{% block content %}
-<body>
- <div class="container">
- <div class="content">
- <div class="row">
- <div class="login-form">
- <h2>Register</h2>
- <form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
- <fieldset>
- <div class="clearfix">
- {{ render_field_with_errors(register_user_form.email) }}
- </div>
- <div class="clearfix">
- {{ render_field_with_errors(register_user_form.password) }}
- </div>
- {% if register_user_form.password_confirm %}
- <div class="clearfix">
- {{ render_field_with_errors(register_user_form.password_confirm) }}
- </div>
- {% endif %}
- {{ render_field(register_user_form.submit) }}
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- </div>
-</body>
-
-{% include "security/_menu.html" %}
-
-{% endblock %}
-
-<!--<form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
+<h1>Register</h1>
+<form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
{{ register_user_form.hidden_tag() }}
{{ render_field_with_errors(register_user_form.email) }}
{{ render_field_with_errors(register_user_form.password) }}
@@ -42,4 +9,5 @@
{{ render_field_with_errors(register_user_form.password_confirm) }}
{% endif %}
{{ render_field(register_user_form.submit) }}
-</form>--> \ No newline at end of file
+</form>
+{% include "security/_menu.html" %} \ No newline at end of file