bsw@75: local resend = param.get("resend", atom.boolean) bsw@75: bsw@286: if not resend and config.locked_profile_fields.notify_email then bsw@286: error("access denied") bsw@286: end bsw@286: bsw@75: if app.session.member.notify_email_locked then bsw@75: if resend then bsw@75: slot.put_into("error", _"We have sent an email with activation link already in the last hour. Please try again later.") bsw@75: else bsw@75: slot.put_into("error", _"You can change your email address only once per hour. Please try again later.") bsw@75: end bsw@75: return false bsw@75: end bsw@75: bsw@75: local email bsw@75: if resend then bsw@75: email = app.session.member.notify_email_unconfirmed bsw@75: else bsw@75: email = param.get("email") bsw@75: end bsw@75: bsw@75: email = util.trim(email) bsw@75: bsw@75: if #email < 3 then bsw@75: slot.put_into("error", _"This email address is too short!") bsw@75: return false bsw@75: end bsw@75: bsw@75: local success = app.session.member:set_notify_email(email) bsw@75: bsw@75: if not success then bsw@75: slot.put_into("error", _"We couldn't deliver a confirmation mail to this address. Please check entered email address.") bsw@75: return false bsw@75: end bsw@75: bsw@75: slot.put_into("notice", _"Your email address has been changed, please check for confirmation email with activation link!")