From 48ba921c234abb218b14d7f1ae4d5b017ab8d388 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 May 2013 20:59:50 +0000 Subject: Added flask_security locally --- wqflask/flask_security/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 wqflask/flask_security/__init__.py (limited to 'wqflask/flask_security/__init__.py') diff --git a/wqflask/flask_security/__init__.py b/wqflask/flask_security/__init__.py new file mode 100644 index 00000000..68267cff --- /dev/null +++ b/wqflask/flask_security/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +""" + flask.ext.security + ~~~~~~~~~~~~~~~~~~ + + Flask-Security is a Flask extension that aims to add quick and simple + security via Flask-Login, Flask-Principal, Flask-WTF, and passlib. + + :copyright: (c) 2012 by Matt Wright. + :license: MIT, see LICENSE for more details. +""" + +__version__ = '1.6.0' + +from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user +from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore +from .decorators import auth_token_required, http_auth_required, \ + login_required, roles_accepted, roles_required +from .forms import ForgotPasswordForm, LoginForm, RegisterForm, \ + ResetPasswordForm, PasswordlessLoginForm, ConfirmRegisterForm +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 -- cgit v1.2.3 From f259acbe4792e8a10a5fea40262c644108f58eba Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 May 2013 22:21:37 +0000 Subject: Modal windows now working better Going to simplify the code next --- wqflask/flask_security/__init__.py | 2 ++ wqflask/wqflask/static/new/javascript/login.coffee | 21 ++++++++++--- wqflask/wqflask/static/new/javascript/login.js | 15 ++++++--- wqflask/wqflask/templates/security/_macros.html | 2 +- wqflask/wqflask/templates/security/login_user.html | 2 +- .../wqflask/templates/security/register_user.html | 2 +- .../templates/security/send_confirmation.html | 36 +++++++++++++++++----- 7 files changed, 59 insertions(+), 21 deletions(-) (limited to 'wqflask/flask_security/__init__.py') diff --git a/wqflask/flask_security/__init__.py b/wqflask/flask_security/__init__.py index 68267cff..297033c9 100644 --- a/wqflask/flask_security/__init__.py +++ b/wqflask/flask_security/__init__.py @@ -12,6 +12,8 @@ __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, \ diff --git a/wqflask/wqflask/static/new/javascript/login.coffee b/wqflask/wqflask/static/new/javascript/login.coffee index 4f38a299..658fd48d 100644 --- a/wqflask/wqflask/static/new/javascript/login.coffee +++ b/wqflask/wqflask/static/new/javascript/login.coffee @@ -1,8 +1,19 @@ $ -> - $(".modalize").colorbox( - onComplete: -> - $(".focused").focus() - ) + #$(".modalize").colorbox( + # onComplete: -> + # $(".focused").focus() + # ) + + $(".modalize").on("click", (event) -> + console.log("modalizing!!!") + event.preventDefault() + $.colorbox( + href: $(this).attr("href") + onComplete: -> + $(".focused").focus() + ) + + ) modal_replace = (event) -> event.preventDefault() @@ -17,7 +28,7 @@ $ -> - $(".modal_replace").on("click", modal_replace) + $(document).on("click", ".modal_replace", modal_replace) form_success = (data) -> $.colorbox( diff --git a/wqflask/wqflask/static/new/javascript/login.js b/wqflask/wqflask/static/new/javascript/login.js index e537ac1e..d7a89f01 100644 --- a/wqflask/wqflask/static/new/javascript/login.js +++ b/wqflask/wqflask/static/new/javascript/login.js @@ -3,10 +3,15 @@ $(function() { var form_success, modal_replace, submit_form; - $(".modalize").colorbox({ - onComplete: function() { - return $(".focused").focus(); - } + $(".modalize").on("click", function(event) { + console.log("modalizing!!!"); + event.preventDefault(); + return $.colorbox({ + href: $(this).attr("href"), + onComplete: function() { + return $(".focused").focus(); + } + }); }); modal_replace = function(event) { event.preventDefault(); @@ -20,7 +25,7 @@ }); return false; }; - $(".modal_replace").on("click", modal_replace); + $(document).on("click", ".modal_replace", modal_replace); form_success = function(data) { return $.colorbox({ open: true, diff --git a/wqflask/wqflask/templates/security/_macros.html b/wqflask/wqflask/templates/security/_macros.html index bd6f9786..c2d8ad71 100644 --- a/wqflask/wqflask/templates/security/_macros.html +++ b/wqflask/wqflask/templates/security/_macros.html @@ -22,7 +22,7 @@

You must confirm your email address before signing in.

Check your email for confirmation instructions.

Can't find the email? Check your spam folder.

-

Still can't find it? +

Still can't find it? Click here to resend.

{% else %} diff --git a/wqflask/wqflask/templates/security/login_user.html b/wqflask/wqflask/templates/security/login_user.html index f982dc08..e1f5970b 100644 --- a/wqflask/wqflask/templates/security/login_user.html +++ b/wqflask/wqflask/templates/security/login_user.html @@ -1,7 +1,7 @@ {% from "security/_macros.html" import render_only_errors %} {% include "security/_messages.html" %} -
+
{{ g.identity}}

Don't have an account?

diff --git a/wqflask/wqflask/templates/security/register_user.html b/wqflask/wqflask/templates/security/register_user.html index 0f068914..9bbcd29f 100644 --- a/wqflask/wqflask/templates/security/register_user.html +++ b/wqflask/wqflask/templates/security/register_user.html @@ -1,7 +1,7 @@ {% from "security/_macros.html" import render_only_errors %} {% include "security/_messages.html" %} -
+

Already have an account?

diff --git a/wqflask/wqflask/templates/security/send_confirmation.html b/wqflask/wqflask/templates/security/send_confirmation.html index 3e828407..29a11257 100644 --- a/wqflask/wqflask/templates/security/send_confirmation.html +++ b/wqflask/wqflask/templates/security/send_confirmation.html @@ -1,9 +1,29 @@ -{% from "security/_macros.html" import render_field_with_errors, render_field %} +{% from "security/_macros.html" import render_only_errors %} {% include "security/_messages.html" %} -

Resend confirmation instructions

-
- {{ send_confirmation_form.hidden_tag() }} - {{ render_field_with_errors(send_confirmation_form.email) }} - {{ render_field(send_confirmation_form.submit) }} -
-{% include "security/_menu.html" %} \ No newline at end of file + +
+

Resend confirmation instructions

+ +
+ +
+ {{ send_confirmation_form.hidden_tag() }} + +
+ +
+ +
+ {{ render_only_errors(send_confirmation_form.email) }} + +
+ +
+
+ +
+
+
+
+
-- cgit v1.2.3