diff options
-rw-r--r-- | askbot/conf/user_settings.py | 15 | ||||
-rw-r--r-- | askbot/deps/django_authopenid/views.py | 14 | ||||
-rw-r--r-- | askbot/views/meta.py | 15 |
3 files changed, 33 insertions, 11 deletions
diff --git a/askbot/conf/user_settings.py b/askbot/conf/user_settings.py index e7dea7c8..a1d5a55c 100644 --- a/askbot/conf/user_settings.py +++ b/askbot/conf/user_settings.py @@ -16,11 +16,20 @@ USER_SETTINGS = livesettings.ConfigurationGroup( ) settings.register( - livesettings.StringValue( + livesettings.LongStringValue( USER_SETTINGS, 'NEW_USER_GREETING', - default = '', - description = _('On-screen greeting shown to the new users') + default='', + description=_('On-screen greeting shown to the new users') + ) +) + +settings.register( + livesettings.BooleanValue( + USER_SETTINGS, + 'ALLOW_ANONYMOUS_FEEDBACK', + default=True, + description=_('Allow anonymous users send feedback') ) ) diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index 642e59a3..cace9968 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -906,7 +906,8 @@ def register(request, login_provider_name=None, user_identifier=None): email = request.session['email'] send_email_key(email, key, handler_url_name='verify_email_and_register') request.session['validation_code'] = key - return HttpResponseRedirect(reverse('verify_email_and_register')) + redirect_url = reverse('verify_email_and_register') + '?next=' + next_url + return HttpResponseRedirect(redirect_url) providers = { 'yahoo':'<font color="purple">Yahoo!</font>', @@ -983,7 +984,7 @@ def verify_email_and_register(request): login(request, user) cleanup_post_register_session(request) - return HttpResponseRedirect(reverse('index')) + return HttpResponseRedirect(get_next_url(request)) except Exception, e: message = _( 'Sorry, registration failed. ' @@ -1005,8 +1006,7 @@ def signup_with_password(request): """ logging.debug(get_request_info(request)) - next = get_next_url(request) - login_form = forms.LoginForm(initial = {'next': next}) + login_form = forms.LoginForm(initial = {'next': get_next_url(request)}) #this is safe because second decorator cleans this field provider_name = request.REQUEST['login_provider'] @@ -1049,7 +1049,7 @@ def signup_with_password(request): ) login(request, user) cleanup_post_register_session(request) - return HttpResponseRedirect(next) + return HttpResponseRedirect(get_next_url(request)) else: request.session['username'] = username request.session['email'] = email @@ -1060,7 +1060,9 @@ def signup_with_password(request): email = request.session['email'] send_email_key(email, key, handler_url_name='verify_email_and_register') request.session['validation_code'] = key - return HttpResponseRedirect(reverse('verify_email_and_register')) + redirect_url = reverse('verify_email_and_register') + \ + '?next=' + get_next_url(request) + return HttpResponseRedirect(redirect_url) else: #todo: this can be solved with a decorator, maybe diff --git a/askbot/views/meta.py b/askbot/views/meta.py index 8e2c555e..4e7e0283 100644 --- a/askbot/views/meta.py +++ b/askbot/views/meta.py @@ -13,6 +13,7 @@ from django.views import static from django.views.decorators import csrf from django.db.models import Max, Count from askbot.forms import FeedbackForm +from askbot.utils.url_utils import get_login_url from askbot.utils.forms import get_next_url from askbot.mail import mail_moderators from askbot.models import BadgeData, Award, User @@ -81,9 +82,19 @@ def faq(request): def feedback(request): data = {'page_class': 'meta'} form = None + + if askbot_settings.ALLOW_ANONYMOUS_FEEDBACK is False: + if request.user.is_anonymous(): + message = _('Please sign in or register to send your feedback') + request.user.message_set.create(message=message) + redirect_url = get_login_url() + '?next=' + request.path + return HttpResponseRedirect(redirect_url) + if request.method == "POST": - form = FeedbackForm(is_auth = request.user.is_authenticated(), - data = request.POST) + form = FeedbackForm( + is_auth=request.user.is_authenticated(), + data=request.POST + ) if form.is_valid(): if not request.user.is_authenticated(): data['email'] = form.cleaned_data.get('email',None) |