liquid_feedback_frontend
changeset 203:5e35add677ee
Added support for member.locked and account expiry mechanism. Small corrections.
author | bsw |
---|---|
date | Tue Jan 25 13:43:46 2011 +0100 (2011-01-25) |
parents | e60a26bf535b |
children | 30678d3935ab |
files | app/main/index/_action/login.lua app/main/member/show_tab.lua config/default.lua model/member.lua |
line diff
1.1 --- a/app/main/index/_action/login.lua Mon Nov 08 15:49:23 2010 +0100 1.2 +++ b/app/main/index/_action/login.lua Tue Jan 25 13:43:46 2011 +0100 1.3 @@ -1,10 +1,10 @@ 1.4 local member = Member:by_login_and_password(param.get('login'), param.get('password')) 1.5 1.6 if member then 1.7 + member.last_login = "now" 1.8 + member.active = true 1.9 + member:save() 1.10 app.session.member = member 1.11 - if config.last_login_enabled then 1.12 - db:query{ "UPDATE member SET last_login = now() WHERE id = ?", member.id } 1.13 - end 1.14 app.session:save() 1.15 slot.select("notice", function() 1.16 ui.tag{ content = _'Login successful!' }
2.1 --- a/app/main/member/show_tab.lua Mon Nov 08 15:49:23 2010 +0100 2.2 +++ b/app/main/member/show_tab.lua Tue Jan 25 13:43:46 2011 +0100 2.3 @@ -46,16 +46,12 @@ 2.4 local broken_delegations = Delegation:new_selector() 2.5 :join("member", nil, "delegation.trustee_id = member.id") 2.6 :add_where{"delegation.truster_id = ?", member.id} 2.7 - if config.delegation_warning_time and config.last_login_enabled then 2.8 - broken_delegations:add_where{"member.active = 'f' OR (member.last_login IS NULL OR age(member.last_login) > ?::interval)", config.delegation_warning_time} 2.9 - else 2.10 - broken_delegations:add_where{"member.active = 'f'"} 2.11 - end 2.12 + :add_where{"member.active = 'f' OR (member.last_login_public IS NULL OR age(member.last_login) > ?::interval)", config.delegation_warning_time } 2.13 2.14 if broken_delegations:count() > 0 then 2.15 tabs[#tabs+1] = { 2.16 class = "red", 2.17 - name = "problem_delegations", 2.18 + name = "broken_delegations", 2.19 label = _"Delegation problems" .. " (" .. tostring(broken_delegations:count()) .. ")", 2.20 icon = { static = "icons/16/table_go.png" }, 2.21 module = "delegation",
3.1 --- a/config/default.lua Mon Nov 08 15:49:23 2010 +0100 3.2 +++ b/config/default.lua Tue Jan 25 13:43:46 2011 +0100 3.3 @@ -34,10 +34,10 @@ 3.4 3.5 config.default_lang = "de" 3.6 3.7 --- after how long is a user considered inactive and the trustee will see warning\ 3.8 +-- after how long is a user considered inactive and the trustee will see warning 3.9 -- will not work unless config.last_login_enabled is set to true 3.10 -- notation is according to postgresql intervals, nil turns off feature 3.11 -config.delegation_warning_time = '6 weeks' 3.12 +config.delegation_warning_time = '6 months' 3.13 3.14 config.mail_subject_prefix = "[LiquidFeedback] " 3.15 3.16 @@ -53,9 +53,6 @@ 3.17 3.18 config.feature_rss_enabled = false -- feature is broken 3.19 3.20 --- Saving last login of user in database 3.21 -config.last_login_enabled = true 3.22 - 3.23 -- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED! 3.24 config.auth_openid_enabled = false 3.25 config.auth_openid_https_as_default = true
4.1 --- a/model/member.lua Mon Nov 08 15:49:23 2010 +0100 4.2 +++ b/model/member.lua Tue Jan 25 13:43:46 2011 +0100 4.3 @@ -281,7 +281,7 @@ 4.4 function Member:by_login_and_password(login, password) 4.5 local selector = self:new_selector() 4.6 selector:add_where{'"login" = ?', login } 4.7 - selector:add_where('"active"') 4.8 + selector:add_where('NOT "locked"') 4.9 selector:optional_object_mode() 4.10 local member = selector:exec() 4.11 if member and member:check_password(password) then