示例#1
0
    def recoverPasswordByEmail(self):
        email = request.POST['email']
        manager = model.Manager.get_manager_with_email(email)
        
        if manager:
            response = {
                    'secret' : manager.password_secret,
                    'username' : manager.username
                        }
            reset_password_key = str(uuid.uuid1())
            model.Manager.set_reset_password_key( manager.id, reset_password_key )
            
            msg = """\
Hi {0},

We received a request for a password reset.

Your username is: {3}

You can reset your password here:
http://{1}/newPassword/{2}

If you did not issue such a request, please ignore this email.

Thank you,

Rentfox
http://{1}
            """.format(manager.first_name, settings.WEBSITE, manager.reset_password_key, manager.username)
            
            mailman.send([email], 'Reset your password', msg)
        else:
            response = { 'error' : 'Oops! The email address you entered does not exist.' }
        return json.dumps(response)
示例#2
0
文件: rent.py 项目: weixiyen/Rentfox
    def markLate(self):
        unitId = request.POST['unitId']
        latefee = request.POST['latefee']
        forMonth = request.POST['forMonth']
        forYear = request.POST['forYear']
        date = request.POST['date']
        latefeeNum = latefee.replace('$','')
        Transaction.record_latefee(unitId,latefeeNum,forMonth,forYear,date)
        
        remind = True if request.POST['remind'] == 'true' and float(latefeeNum) > 0.0 else False
        if remind:
            tenants = Tenant_lease.get_tenants_from_unit(unitId)
            emails = [tenant.email for tenant in tenants]
            subj = '{0} - late fee owed'.format(request.environ.get('COMPANY_NAME'))
            msg = """\
Dear Tenant,

This is a notice from your landlord that your rent was turned in late.

Amount owed: ${0}

Please pay this amount promptly.

Thanks,

{1}
""".format(latefee, request.environ.get('COMPANY_NAME'))
            mailman.send(emails, subj, msg)
        
        return json.dumps('')
示例#3
0
    def sendLead(self):
        name = request.POST['name']
        email = request.POST['email']
        phone = request.POST['phone']
        message = request.POST['message']
        
        errors = []
        if not valid.email(email):
            errors.append({"selector":"#lead-email", "message":"Please enter a valid email."})
        if len(name) < 3:
            errors.append({"selector":"#lead-name", "message":"Please enter a valid name"})
        
        lead_subj = "Rentfox Lead Inquiry - {0}".format(name)
        lead_msg = """\
Dear Rentfox Sales,

A potential customer would like to be contacted!
Please do your best to provide excellent service and leave a good impression no matter the outcome.

Name: {0}
Email: {1}
Phone (optional): {2}

Message (optional):
{3}

Best Regards,

Rentfox
""".format(name, email, phone, message)

        thanks_subj = "Thanks for your inquiry!"
        thanks_msg = """\
Dear {0},

Thank you for your inquiry regarding Rentfox.
Rentfox is the easy way to manage rental properties online.

We value your business and will respond quickly. We are happy to be of service!

You will hear back from us sometime within the next 24 hours.

Best Regards,

The Rentfox Team
http://{1}
""".format(name, settings.WEBSITE)


        if len(errors) == 0:
            mailman.send([settings.EMAIL_SALES], lead_subj, lead_msg)
            mailman.send([email], thanks_subj, thanks_msg)
        
        return json.dumps({'errors':errors})