# HG changeset patch # User bsw # Date 1366478818 -7200 # Node ID 77873f08d94f662f8e6c8a0d2053669bdf94527b # Parent 5a712ec1a7f19d0a09586f79aa701c8f9d1afd65 Completed support for check delegations, removed debug code diff -r 5a712ec1a7f1 -r 77873f08d94f app/main/index/_action/login.lua --- a/app/main/index/_action/login.lua Sat Apr 20 18:51:28 2013 +0200 +++ b/app/main/index/_action/login.lua Sat Apr 20 19:26:58 2013 +0200 @@ -49,18 +49,30 @@ name = "sessionID", value = etherpad_sesion_id } - end - if member then member.last_login = "now" - if config.check_delegations_interval_hard and member.needs_delegation_check_hard then + + local delegations = Delegation:delegations_to_check_for_member_id(member.id) + + if config.check_delegations_interval_hard + and member.needs_delegation_check_hard + and #delegations > 0 then + app.session.needs_delegation_check = true + else + + if #delegations == 0 then + member.last_delegation_check = "now" + end + member.last_activity = "now" member.active = true + end + if member.lang == nil then member.lang = app.session.lang else diff -r 5a712ec1a7f1 -r 77873f08d94f app/main/index/_action/reset_password.lua --- a/app/main/index/_action/reset_password.lua Sat Apr 20 18:51:28 2013 +0200 +++ b/app/main/index/_action/reset_password.lua Sat Apr 20 19:26:58 2013 +0200 @@ -39,7 +39,7 @@ } end - slot.put_into("notice", _"Reset link has been send for this member") + slot.put_into("notice", _"Your request has been processed.") else local member = Member:new_selector() diff -r 5a712ec1a7f1 -r 77873f08d94f app/main/index/_action/send_login.lua --- a/app/main/index/_action/send_login.lua Sat Apr 20 18:51:28 2013 +0200 +++ b/app/main/index/_action/send_login.lua Sat Apr 20 19:26:58 2013 +0200 @@ -3,7 +3,8 @@ local email = param.get("email") local members = Member:new_selector() - :add_where{ "notify_email = ? OR notify_email_unconfirmed = ?", email, email } + :add_where{ "split_part(notify_email, '@', 1) = split_part(?, '@', 1)", email } + :add_where{ "lower(split_part(notify_email, '@', 2)) = lower(split_part(?, '@', 2))", email } :add_where("login_recovery_expiry ISNULL OR login_recovery_expiry < now()") :exec() @@ -28,9 +29,6 @@ end end) -trace.debug(content) -if true then return end - local success = net.send_mail{ envelope_from = config.mail_envelope_from, from = config.mail_from, @@ -40,3 +38,5 @@ content_type = "text/plain; charset=UTF-8", content = content } + +slot.put_into("notice", _"Your request has been processed.") diff -r 5a712ec1a7f1 -r 77873f08d94f app/main/index/_notifications.lua --- a/app/main/index/_notifications.lua Sat Apr 20 18:51:28 2013 +0200 +++ b/app/main/index/_notifications.lua Sat Apr 20 19:26:58 2013 +0200 @@ -21,11 +21,18 @@ :single_object_mode() :exec() + if member.needs_delegation_check_soft then - notification_links[#notification_links+1] = { - module = "index", view = "check_delegations", - text = _"Check your delegations!" - } + + local delegations = Delegation:delegations_to_check_for_member_id(member.id) + + if #delegations > 0 then + notification_links[#notification_links+1] = { + module = "index", view = "check_delegations", + text = _"Check your delegations!" + } + end + end end