liquid_feedback_frontend
diff app/main/index/_action/reset_password.lua @ 6:8d91bccab0bf
Version beta2
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
Possibility to browse voters of a closed issue
Registration with invite code
Email confirmation and password recovery
Download function (for database dumps) added
Critical bug solved, which made it impossible to select your opinion on other peoples suggestions
Catching error, when trying to set an opinion on a suggestion which has been meanwhile deleted
Fixed wrong sorting order for "supporters" or "potential supporters"
Added format info for birthday (Error when entering dates in wrong format is NOT fixed in this release)
Strip space characters from certain fields and ensure they contain at least 3 characters
Showing grade in opinion/list as clear text instead of integer value
More information on initiative is displayed while voting
Colored notification box shown on pages of issues or initiatives which are currently in voting state
Changed default filter for issues to "Open"
Back link on suggestion page
Some optical changes
Removed wrong space character in LICENSE file
author | bsw/jbe |
---|---|
date | Sat Jan 02 12:00:00 2010 +0100 (2010-01-02) |
parents | |
children | bf735d8095aa |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/index/_action/reset_password.lua Sat Jan 02 12:00:00 2010 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +local secret = param.get("secret") 1.5 + 1.6 +if not secret then 1.7 + 1.8 + local member = Member:new_selector() 1.9 + :add_where{ "login = ?", param.get("login") } 1.10 + :add_where("password_reset_secret ISNULL OR password_reset_secret_expiry < now()") 1.11 + :optional_object_mode() 1.12 + :exec() 1.13 + 1.14 + if member then 1.15 + if not member.notify_email then 1.16 + slot.put_into("error", _"Sorry, but there is not confirmed email address for your account. Please contact the administrator or support.") 1.17 + return false 1.18 + end 1.19 + member.password_reset_secret = multirand.string( 24, "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" ) 1.20 + local expiry = db:query("SELECT now() + '1 days'::interval as expiry", "object").expiry 1.21 + member.password_reset_secret_expiry = expiry 1.22 + member:save() 1.23 + local content = slot.use_temporary(function() 1.24 + slot.put(_"Hello " .. member.name .. ",\n\n") 1.25 + slot.put(_"to reset your password please click on the following link:\n\n") 1.26 + slot.put(config.absolute_base_url .. "index/reset_password.html?secret=" .. member.password_reset_secret .. "\n\n") 1.27 + slot.put(_"If this link is not working, please open following url in your web browser:\n\n") 1.28 + slot.put(config.absolute_base_url .. "index/reset_password.html\n\n") 1.29 + slot.put(_"On that page please enter the reset code:\n\n") 1.30 + slot.put(member.password_reset_secret .. "\n\n") 1.31 + end) 1.32 + local success = net.send_mail{ 1.33 + envelope_from = config.mail_envelope_from, 1.34 + from = config.mail_from, 1.35 + reply_to = config.mail_reply_to, 1.36 + to = member.notify_email, 1.37 + subject = config.mail_subject_prefix .. _"Password reset request", 1.38 + content_type = "text/plain; charset=UTF-8", 1.39 + content = content 1.40 + } 1.41 + end 1.42 + 1.43 + slot.put_into("notice", _"Reset link has been send for this member") 1.44 + 1.45 +else 1.46 + local member = Member:new_selector() 1.47 + :add_where{ "password_reset_secret = ?", secret } 1.48 + :add_where{ "password_reset_secret_expiry > now()" } 1.49 + :optional_object_mode() 1.50 + :exec() 1.51 + 1.52 + if not member then 1.53 + slot.put_into("error", _"Reset code is invalid!") 1.54 + return false 1.55 + end 1.56 + 1.57 + local password1 = param.get("password1") 1.58 + local password2 = param.get("password2") 1.59 + 1.60 + if password1 ~= password2 then 1.61 + slot.put_into("error", _"Passwords don't match!") 1.62 + return false 1.63 + end 1.64 + 1.65 + if #password1 < 8 then 1.66 + slot.put_into("error", _"Passwords must consist of at least 8 characters!") 1.67 + return false 1.68 + end 1.69 + 1.70 + member:set_password(password1) 1.71 + member.password_reset_secret = nil 1.72 + member.password_reset_secret_expiry = nil 1.73 + member:save() 1.74 + 1.75 + slot.put_into("notice", _"Password has been reset successfully") 1.76 + 1.77 +end 1.78 \ No newline at end of file