From ee355966c84fb32541b3940eee6adae15c89cc19 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Fri, 3 May 2013 08:50:30 -0700 Subject: basic_auth v0 plugin working --- mediagoblin/plugins/basic_auth/forms.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 mediagoblin/plugins/basic_auth/forms.py (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py new file mode 100644 index 00000000..28eb7d0a --- /dev/null +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -0,0 +1,30 @@ +import wtforms + +from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ +from mediagoblin.auth.forms import normalize_user_or_email_field + + +class RegistrationForm(wtforms.Form): + username = wtforms.TextField( + _('Username'), + [wtforms.validators.Required(), + normalize_user_or_email_field(allow_email=False)]) + password = wtforms.PasswordField( + _('Password'), + [wtforms.validators.Required(), + wtforms.validators.Length(min=5, max=1024)]) + email = wtforms.TextField( + _('Email address'), + [wtforms.validators.Required(), + normalize_user_or_email_field(allow_user=False)]) + + +class LoginForm(wtforms.Form): + username = wtforms.TextField( + _('Username or Email'), + [wtforms.validators.Required(), + normalize_user_or_email_field()]) + password = wtforms.PasswordField( + _('Password'), + [wtforms.validators.Required(), + wtforms.validators.Length(min=5, max=1024)]) -- cgit v1.2.3 From 58460a8301a8a654a103929260c6d91e2b376960 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 7 May 2013 08:36:04 -0700 Subject: moved forgot pw views to basic_auth plugin --- mediagoblin/plugins/basic_auth/forms.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 28eb7d0a..65981691 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -28,3 +28,23 @@ class LoginForm(wtforms.Form): _('Password'), [wtforms.validators.Required(), wtforms.validators.Length(min=5, max=1024)]) + + +class ForgotPassForm(wtforms.Form): + username = wtforms.TextField( + _('Username or email'), + [wtforms.validators.Required(), + normalize_user_or_email_field()]) + + +class ChangePassForm(wtforms.Form): + password = wtforms.PasswordField( + 'Password', + [wtforms.validators.Required(), + wtforms.validators.Length(min=5, max=1024)]) + userid = wtforms.HiddenField( + '', + [wtforms.validators.Required()]) + token = wtforms.HiddenField( + '', + [wtforms.validators.Required()]) -- cgit v1.2.3 From 0f3504e35b823f7ab391261e6d9a999bcf655d03 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Mon, 13 May 2013 15:48:56 -0700 Subject: moved normalize_user_or_email_field to auth/tools.py from auth/forms.py --- mediagoblin/plugins/basic_auth/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 65981691..fe10d89f 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -1,7 +1,7 @@ import wtforms from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ -from mediagoblin.auth.forms import normalize_user_or_email_field +from mediagoblin.auth.tools import normalize_user_or_email_field class RegistrationForm(wtforms.Form): -- cgit v1.2.3 From ba016fda9af97c4c584f6c5be55aef6082353ec2 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Fri, 17 May 2013 13:06:46 -0700 Subject: added Copyright header to basic_auth/forms.py --- mediagoblin/plugins/basic_auth/forms.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index fe10d89f..5f9dc127 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -1,3 +1,18 @@ +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . import wtforms from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ -- cgit v1.2.3 From c94316bff4ad360e99a336889a76d8e75247885c Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Mon, 20 May 2013 08:45:04 -0700 Subject: Modified basic_auth plugin to work with modified auth plugin hooks. Added context variables. Removed basic_auth/tools which was previously renamed to basic_auth/lib. --- mediagoblin/plugins/basic_auth/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 5f9dc127..8321c227 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -26,7 +26,7 @@ class RegistrationForm(wtforms.Form): normalize_user_or_email_field(allow_email=False)]) password = wtforms.PasswordField( _('Password'), - [wtforms.validators.Required(), + [wtforms.validators.Optional(), wtforms.validators.Length(min=5, max=1024)]) email = wtforms.TextField( _('Email address'), -- cgit v1.2.3 From f339b76a4ee04571bd0a94d20a5d53d7f3d8d235 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Fri, 24 May 2013 18:09:57 -0700 Subject: moving forgot_password views back to gmg/auth and cleanup --- mediagoblin/plugins/basic_auth/forms.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 8321c227..f389b21e 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -26,7 +26,7 @@ class RegistrationForm(wtforms.Form): normalize_user_or_email_field(allow_email=False)]) password = wtforms.PasswordField( _('Password'), - [wtforms.validators.Optional(), + [wtforms.validators.Required(), wtforms.validators.Length(min=5, max=1024)]) email = wtforms.TextField( _('Email address'), @@ -43,23 +43,3 @@ class LoginForm(wtforms.Form): _('Password'), [wtforms.validators.Required(), wtforms.validators.Length(min=5, max=1024)]) - - -class ForgotPassForm(wtforms.Form): - username = wtforms.TextField( - _('Username or email'), - [wtforms.validators.Required(), - normalize_user_or_email_field()]) - - -class ChangePassForm(wtforms.Form): - password = wtforms.PasswordField( - 'Password', - [wtforms.validators.Required(), - wtforms.validators.Length(min=5, max=1024)]) - userid = wtforms.HiddenField( - '', - [wtforms.validators.Required()]) - token = wtforms.HiddenField( - '', - [wtforms.validators.Required()]) -- cgit v1.2.3 From e4deacd9c898b6a627d892ef09d3d6efeb88ac52 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Fri, 21 Jun 2013 14:14:40 -0700 Subject: changes after cwebb's review --- mediagoblin/plugins/basic_auth/forms.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index f389b21e..72d99dff 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -40,6 +40,4 @@ class LoginForm(wtforms.Form): [wtforms.validators.Required(), normalize_user_or_email_field()]) password = wtforms.PasswordField( - _('Password'), - [wtforms.validators.Required(), - wtforms.validators.Length(min=5, max=1024)]) + _('Password')) -- cgit v1.2.3 From 527b7e3b57906a86dae914daae0399b04b3b5388 Mon Sep 17 00:00:00 2001 From: Jakob Kramer Date: Fri, 10 May 2013 00:40:13 +0200 Subject: add login option: stay_logged_in As proposed in issue #354; it adds an attribute max_age to mediagoblin.tools.session.Session that is passed to response.set_cookie; max_age is set to 30 days if the checkbox is selected --- mediagoblin/plugins/basic_auth/forms.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 72d99dff..0793f5f4 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -41,3 +41,5 @@ class LoginForm(wtforms.Form): normalize_user_or_email_field()]) password = wtforms.PasswordField( _('Password')) + stay_logged_in = wtforms.BooleanField( + _('Stay logged in')) -- cgit v1.2.3 From 0ec7ce4ec684ebeb205e7dfa3f3f08a814074297 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 25 Jun 2013 16:37:28 -0700 Subject: updated to new render_divs macro --- mediagoblin/plugins/basic_auth/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mediagoblin/plugins/basic_auth/forms.py') diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index 0793f5f4..6cf01b38 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -42,4 +42,5 @@ class LoginForm(wtforms.Form): password = wtforms.PasswordField( _('Password')) stay_logged_in = wtforms.BooleanField( - _('Stay logged in')) + label='', + description=_('Stay logged in')) -- cgit v1.2.3