liquid_feedback_frontend

diff model/member.lua @ 286:c587d8762e62

Registration process updated for Core 2.0, lockable member fields, notification settings
author bsw
date Sat Feb 25 11:51:37 2012 +0100 (2012-02-25)
parents b77e6a17ca77
children c4dd225578d4
line diff
     1.1 --- a/model/member.lua	Fri Feb 17 15:16:02 2012 +0100
     1.2 +++ b/model/member.lua	Sat Feb 25 11:51:37 2012 +0100
     1.3 @@ -325,6 +325,30 @@
     1.4      :add_where("active")
     1.5  end
     1.6  
     1.7 +function Member.object:send_invitation()
     1.8 +  trace.disable()
     1.9 +  self.invite_code = multirand.string( 24, "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" )
    1.10 +  local content = slot.use_temporary(function()
    1.11 +    slot.put(_"Hello\n\n")
    1.12 +    slot.put(_"You are invited to LiquidFeedback. To register please click the following link:\n\n")
    1.13 +    slot.put(config.absolute_base_url .. "index/register.html?invite_key=" .. self.invite_code .. "\n\n")
    1.14 +    slot.put(_"If this link is not working, please open following url in your web browser:\n\n")
    1.15 +    slot.put(config.absolute_base_url .. "index/register.html\n\n")
    1.16 +    slot.put(_"On that page please enter the invite key:\n\n")
    1.17 +    slot.put(self.invite_code .. "\n\n")
    1.18 +  end)
    1.19 +  local success = net.send_mail{
    1.20 +    envelope_from = config.mail_envelope_from,
    1.21 +    from          = config.mail_from,
    1.22 +    reply_to      = config.mail_reply_to,
    1.23 +    to            = self.notify_email_unconfirmed or self.notify_email,
    1.24 +    subject       = config.mail_subject_prefix .. _"Invitation to LiquidFeedback",
    1.25 +    content_type  = "text/plain; charset=UTF-8",
    1.26 +    content       = content
    1.27 +  }
    1.28 +  return success
    1.29 +end
    1.30 +
    1.31  function Member.object:set_notify_email(notify_email)
    1.32    trace.disable()
    1.33    local expiry = db:query("SELECT now() + '7 days'::interval as expiry", "object").expiry

Impressum / About Us