Exemple #1
0
def _process_restfood_account_information(userprofile,request,account_template):
    password = _request_param_post(request, 'password')
    mobile = _request_param_post(request, 'mobile')
    office_place = _request_param_post(request, 'office_place')
    office_landmark = _request_param_post(request, 'office_landmark')
    office_area = _request_param_post(request, 'office_area')
    office_zip = _request_param_post(request, 'office_zip')
    from users.forms import AccountForm
    accountform = AccountForm({'mobile':mobile,'password':password,
                               'home_place':userprofile.source.place,'home_landmark':userprofile.source.landmark,'home_area':userprofile.source.area,'home_zip':userprofile.source.zip,
                               'office_place':office_place,'office_landmark':office_landmark,'office_area':office_area,'office_zip':office_zip})
    if not accountform.is_valid():
        _add_errormsg(request, 'Please valid information in all the required fields')
        return response(account_template,locals(),request)
    password = accountform.cleaned_data.get('password')
    print 'password:%s' % password
    userprofile.set_password(password)
    print 'password reset done'
    mobile = accountform.cleaned_data.get('mobile')
    userprofile.mobile = mobile
    userprofile.save()
    office_place = accountform.cleaned_data.get('office_place')
    office_landmark = accountform.cleaned_data.get('office_landmark')
    office_area = accountform.cleaned_data.get('office_area')
    office_zip = accountform.cleaned_data.get('office_zip')
    userprofile.set_destination_address(destination_place=office_place,destination_area=office_area,destination_landmark=office_landmark,destination_zip=office_zip)
    _add_successmsg(request, 'Account Information saved Successfully')
    return response(account_template,locals(),request)
Exemple #2
0
def view_reset_password(request, passwordreset_template):
    from users.forms import PasswordResetForm
    if request.method == 'POST':
        form = PasswordResetForm(post_data(request))
        if not form.is_valid():
            return response(passwordreset_template,locals(),request)
        email = form.cleaned_data.get('email')
        from users.models import UserProfile
        userprofile = UserProfile.objects.get(email=email)
        new_password = userprofile.reset_password()
        from utils.emailer import passwordreset_mailer
        passwordreset_mailer(userprofile, new_password)
        from users.messages import PASSWORD_RESET_EMAIL_SUCCESS
        _add_successmsg(request, PASSWORD_RESET_EMAIL_SUCCESS % email)
        return response(passwordreset_template,locals(),request)
    form = PasswordResetForm()
    return response(passwordreset_template,locals(),request)
Exemple #3
0
def view_contactus(request,homepage_template,contactus_template):
    selected_maintab = 'contactus'
    if request.method != 'POST':
        from common.forms import ContactUsQueryForm
        form = ContactUsQueryForm()
        return response(contactus_template, locals(), request)
    from common.forms import ContactUsQueryForm
    form = ContactUsQueryForm(post_data(request))
    if not form.is_valid():
        return response(contactus_template, locals(), request)
    email = form.cleaned_data.get('email')
    name = form.cleaned_data.get('name')
    query = form.cleaned_data.get('query')
    from utils.emailer import customer_query_emailer
    mail_sent = customer_query_emailer(subject="Customer Query",from_email=email,email_body=query,from_name=name)
    if mail_sent:
        _add_successmsg(request,'Query Successfully Submitted. We will get back to you very soon. Thankyou.')
        return response(homepage_template, locals(), request)
    _add_errormsg(request,'Query can\'t be submitted now. Please try again.')
    return response(contactus_template, locals(), request)
Exemple #4
0
def view_refer_friend(request, referfriend_template):
    if request.method != 'POST':
        from common.forms import ReferFriendForm
        form = ReferFriendForm()
        return response(referfriend_template, locals(), request)
    from common.forms import ReferFriendForm
    form = ReferFriendForm(post_data(request))
    if not form.is_valid():
        _add_errormsg(request,'Please fill up valid inforsettingsmation in required fields')
        return response(referfriend_template, locals(), request)
    name = form.cleaned_data.get('name')
    email = form.cleaned_data.get('email')
    ref_emails = form.cleaned_data.get('ref_emails')
    ref_mobiles = form.cleaned_data.get('ref_mobiles')
    if _send_invitations(request,name, email, ref_emails, ref_mobiles):
        _add_successmsg(request, 'Your friend(s) \' %s \' have been invited. Thanks for being with favmeal!' % (ref_emails))
        return response(referfriend_template, locals(), request)        
    else:
        _add_errormsg(request,'There seems to be a problem in sending the invitation. Please try again!')
        return response(referfriend_template, locals(), request)        
Exemple #5
0
def _process_homefood_account_information(userprofile,request,account_template):
    from users.forms import AccountForm
    accountform = AccountForm(post_data(request))
    if not accountform.is_valid():
        _add_errormsg(request, 'Please valid information in all the required fields')
        return response(account_template,locals(),request)
    password = accountform.cleaned_data.get('password')
    userprofile.set_password(password)
    mobile = accountform.cleaned_data.get('mobile')
    userprofile.mobile = mobile
    home_place = accountform.cleaned_data.get('home_place')
    home_landmark = accountform.cleaned_data.get('home_landmark')
    home_area = accountform.cleaned_data.get('home_area')
    home_zip = accountform.cleaned_data.get('home_zip')
    userprofile.set_source_address(source_place=home_place,source_area=home_area,source_landmark=home_landmark,source_zip=home_zip)
    office_place = accountform.cleaned_data.get('office_place')
    office_landmark = accountform.cleaned_data.get('office_landmark')
    office_area = accountform.cleaned_data.get('office_area')
    office_zip = accountform.cleaned_data.get('office_zip')
    userprofile.set_destination_address(destination_place=office_place,destination_area=office_area,destination_landmark=office_landmark,destination_zip=office_zip)
    _add_successmsg(request, 'Account Information saved Successfully')
    return response(account_template,locals(),request)