summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-04-15 15:56:10 -0500
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-04-15 15:56:10 -0500
commitc4b1d9152ecd66fdc89be21a819f70633235f551 (patch)
tree31d53764eb1516f4558f546b281f421222f171a8
parentbb1a73f353ddfc15b31ad78e4778bd9bdc3abd22 (diff)
downloadaskbot-c4b1d9152ecd66fdc89be21a819f70633235f551.tar.gz
askbot-c4b1d9152ecd66fdc89be21a819f70633235f551.tar.bz2
askbot-c4b1d9152ecd66fdc89be21a819f70633235f551.zip
removed empty box on the registration page when login buttons are disabled
-rw-r--r--askbot/auth.py42
-rw-r--r--askbot/skins/common/media/jquery-openid/openid.css3
-rw-r--r--askbot/skins/common/templates/authopenid/authopenid_macros.html77
-rw-r--r--askbot/skins/common/templates/authopenid/signin.html17
4 files changed, 84 insertions, 55 deletions
diff --git a/askbot/auth.py b/askbot/auth.py
index 5c0f7bd9..eba24c80 100644
--- a/askbot/auth.py
+++ b/askbot/auth.py
@@ -199,6 +199,11 @@ def onAnswerAccept(answer, user, timestamp=None):
reputation=answer.author.reputation)
reputation.save()
+ if answer.author == question.author and user == question.author:
+ #a plug to prevent reputation gaming by posting a question
+ #then answering and accepting as best all by the same person
+ return
+
user.receive_reputation(askbot_settings.REP_GAIN_FOR_ACCEPTING_ANSWER)
user.save()
reputation = Repute(user=user,
@@ -214,24 +219,29 @@ def onAnswerAcceptCanceled(answer, user, timestamp=None):
if timestamp is None:
timestamp = datetime.datetime.now()
answer.thread.set_accepted_answer(answer=None, timestamp=None)
-
- answer.author.receive_reputation(
- askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE
- )
- answer.author.save()
-
question = answer.thread._question_post()
- reputation = Repute(
- user=answer.author,
- negative=\
- askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE,
- question=question,
- reputed_at=timestamp,
- reputation_type=-2,
- reputation=answer.author.reputation
- )
- reputation.save()
+ if user != answer.author:
+ answer.author.receive_reputation(
+ askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE
+ )
+ answer.author.save()
+ reputation = Repute(
+ user=answer.author,
+ negative=\
+ askbot_settings.REP_LOSS_FOR_RECEIVING_CANCELATION_OF_ANSWER_ACCEPTANCE,
+ question=question,
+ reputed_at=timestamp,
+ reputation_type=-2,
+ reputation=answer.author.reputation
+ )
+ reputation.save()
+
+ if answer.author == question.author and user == question.author:
+ #a symmettric measure for the reputation gaming plug
+ #as in the onAnswerAccept function
+ #here it protects the user from uwanted reputation loss
+ return
user.receive_reputation(
askbot_settings.REP_LOSS_FOR_CANCELING_ANSWER_ACCEPTANCE
diff --git a/askbot/skins/common/media/jquery-openid/openid.css b/askbot/skins/common/media/jquery-openid/openid.css
index 00287224..f9430108 100644
--- a/askbot/skins/common/media/jquery-openid/openid.css
+++ b/askbot/skins/common/media/jquery-openid/openid.css
@@ -1,7 +1,8 @@
-div#login-icons {margin:10px 0 0 0;padding:10px;border:#eee 1px solid;}
+div#login-icons {padding:20px 0 0 0;}
ul.login-icons {width: 450px; margin:0;padding:0;text-align:left; list-style-type:none; display:block;}
ul.login-icons li {display:inline;}
ul.large input {height: 40px; width: 90px;border:1px solid #ccc;margin:0 5px 5px 0;}
+.openid-signin h1 {margin-top: -15px; padding-bottom: 10px;}
.openid-signin h2 {margin-top:15px;}
.openid-signin h2#account-recovery-heading {margin-bottom:2px;}
#account-recovery-form p.hint a {color:#1b79bd; text-decoration: none;}
diff --git a/askbot/skins/common/templates/authopenid/authopenid_macros.html b/askbot/skins/common/templates/authopenid/authopenid_macros.html
index 477d277c..9d35ac6f 100644
--- a/askbot/skins/common/templates/authopenid/authopenid_macros.html
+++ b/askbot/skins/common/templates/authopenid/authopenid_macros.html
@@ -15,44 +15,55 @@
minor_login_providers = None,
hide_local_login = False,
settings = None,
- logged_in = False
+ logged_in = False,
+ show_buttons = True
)
%}
- <div id="login-icons">
- <ul class="login-icons large">
- {% for login_provider in major_login_providers %}
- {% if login_provider.name == 'local' and hide_local_login == True %}
- {# do nothing here, left if statement this way for simplicity #}
- {% else %}
- {% if logged_in == True and login_provider.type == 'password' and login_provider.password_changeable == False %}
+ {% if show_buttons == True %}{# a hack #}
+ <div id="login-icons">
+ {% if major_login_providers %}
+ <ul class="login-icons large">
+ {% for login_provider in major_login_providers %}
+ {% if login_provider.name == 'local' and hide_local_login == True %}
+ {# do nothing here, left if statement this way for simplicity #}
+ {% else %}
+ {% if logged_in == True and login_provider.type == 'password'
+ and login_provider.password_changeable == False
+ %}
+ {% else %}
+ <li>
+ {{ login_provider_input(login_provider) }}
+ </li>
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% if minor_login_providers %}
+ <ul class="login-icons small">
+ {% for login_provider in minor_login_providers %}
+ {% if logged_in == True and login_provider.type == 'password'
+ and login_provider.password_changeable == False
+ %}
{% else %}
<li>
{{ login_provider_input(login_provider) }}
</li>
{% endif %}
- {% endif %}
- {% endfor %}
- </ul>
- <ul class="login-icons small">
- {% for login_provider in minor_login_providers %}
- {% if logged_in == True and login_provider.type == 'password' and login_provider.password_changeable == False %}
- {% else %}
- <li>
- {{ login_provider_input(login_provider) }}
- </li>
- {% endif %}
- {% endfor %}
- </ul>
- </div>
- <fieldset
- id="openid-fs"
- {% if not login_form.openid_login_token.errors %}
- style="display:none;"
- {% endif %}
- >
- <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
- <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
- <input type="text" name="openid_login_token" />
- <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
- </fieldset>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ </div>
+ <fieldset
+ id="openid-fs"
+ {% if not login_form.openid_login_token.errors %}
+ style="display:none;"
+ {% endif %}
+ >
+ <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
+ <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
+ <input type="text" name="openid_login_token" />
+ <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
+ </fieldset>
+ {% endif %}
{% endmacro %}
diff --git a/askbot/skins/common/templates/authopenid/signin.html b/askbot/skins/common/templates/authopenid/signin.html
index f4bf82c9..e849db20 100644
--- a/askbot/skins/common/templates/authopenid/signin.html
+++ b/askbot/skins/common/templates/authopenid/signin.html
@@ -25,7 +25,7 @@
{% endif %}
<p id='login-intro'>
{% if view_subtype == 'default' and have_buttons %}
- {% trans %}Take a pick of your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
+ {% trans %}Choose your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
{% elif view_subtype == 'add_openid' and have_buttons %}
{% if existing_login_methods %}
{% trans %}It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods.{% endtrans %}
@@ -61,7 +61,8 @@
minor_login_providers = minor_login_providers,
hide_local_login = settings.SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN,
settings = settings,
- logged_in = user.is_authenticated()
+ logged_in = user.is_authenticated(),
+ show_buttons = have_buttons
)
}}
{% if use_password_login == True %}
@@ -83,9 +84,15 @@
>
{{login_form.password_action}}
{% if user.is_anonymous() %}
- <h2 id="password-heading">
- {% trans %}Please enter your <span>user name and password</span>, then sign in{% endtrans %}
- </h2>
+ {% if have_buttons %}
+ <h2 id="password-heading">
+ {% trans %}or enter your <span>user name and password</span>, then sign in{% endtrans %}
+ </h2>
+ {% else %}
+ <h1 class="section-title">
+ {% trans %}Please, sign in{% endtrans %}
+ </h1>
+ {% endif %}
{% if have_buttons %}
<p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
{% endif %}