Beispiel #1
0
def handle(request):   
    if request.method == 'GET':
        return siteaction.render_to_response('idxcaptcha.htm')
    elif request.method == 'POST':
        captchatextin = request.session['signup_captcha_text']
        if dataplus.dictGetVal(request.REQUEST,'captcha_text') != captchatextin:
            return siteaction.render_to_response('idxcaptcha.htm',
                    {'error_html':'The captcha text entered is incorrect.'})
                
        params = request.session['signup-params']
        if params['username'].lower() in config.reserved_words or models.Account.objects.filter(username=params['username']).count() > 0:
            countries = models.Country.objects.all().order_by('name')
            country_select_html = hotmetal.elemSelect([('Select', '')], countries,
                lambda x:x.name, lambda x:x.code, dataplus.dictGetVal(request.REQUEST,'country'), 'name="country" id="country" style="width:160px"')
            
            industry_cats = models.IndustryCategory.objects.all()
            industry_cats_html = hotmetal.elemSelect([('Select', '')], industry_cats,
                lambda x:x.name, lambda x:x.name, dataplus.dictGetVal(request.REQUEST,'industry_category'), 'name="industry_category" id="industry_category" style="width:160px"')
            
            experience_select_html = hotmetal.elemSelect([('Select', '-1')], range(0,51),
                lambda x:x, lambda x:x, dataplus.dictGetVal(request.REQUEST,'experience'), 'name="experience" id="experience" style="width:90px"')
                    
            error_message = 'Username already exists. Please choose another'
            return siteaction.render_to_response('index.htm', 
                {'error_html': '<p class="error-note">' + error_message + '</p>',
                'name':params['name'],
                'username':params['username'],
                'email':params['email'],
                'country_select_html':country_select_html,
                'industry_categories_html':industry_cats_html,
                'experience_select_html':experience_select_html})
        else:           
            req_username = params['username'].lower()
            user = siteaction.createUser(req_username, params['name'], params['password'], params['email'], 
                    params['country'], params['industry_category'].replace('&amp;','&'), params['experience'])                 
           
            request.session['signup-params'] = None
            
            useraccount = user.account
        
            #none if these users would have posted their resume, or setup preferences....
            todoResumeMail_subject = '<span style="color:#FF9900">Next step: Update your Resume</span>'
            todoResumeMail_body_html = '<p>To effectively use socialray for Professional Networking and Jobs, you need to update your resume. You can do so by opening the <a href="http://www.socialray.org/me/editresume.htm">Resume Editor</a>.</p>' + \
                '<p>Regards,<br />Socialray Team</p>'
            mailman.sendToInbox(None, req_username, todoResumeMail_subject, todoResumeMail_body_html, 'SA')
            
            session_id = sessions_client.query('addNewSession', [useraccount.username])
            if session_id:
                chat_settings = models.ChatSettings.objects.get(account=useraccount)
                livewire_client.command('updateUserSession', [session_id, useraccount.username, useraccount.name, chat_settings.online_status, 
                    chat_settings.custom_message, chat_settings.invite_preference, chat_settings.ignore_list, 
                    dataplus.getStaticUrl(chat_settings.image_size1_file_path), dataplus.getStaticUrl(chat_settings.image_size2_file_path), 
                    dataplus.getStaticUrl(chat_settings.image_size3_file_path)])

                return siteaction.redirectWithCookie('/me', 'session_id', session_id)
            else:
                return HttpResponseRedirect('500.html')
 def internalSender(rcvr_accounts):
     rcvr = rcvr_accounts[0]
     mailman.sendToInbox(myself.username, rcvr.username, subject, html_message, 'TM', 'H')
 def internalSender(rcvr_accounts):
     mailman.sendToInbox(myself.username, rcvr_accounts[0].username, subject, html_message)
 def internalSender(rcvr_accounts):
     mailman.sendToInbox(sender.username, user.username, subject, html_message)
 def internalSender(rcvr_accounts):
     mailman.sendToInbox(myself.username, rcvr_accounts[0].username, 'Request to join ' + community.name, msg_to_admin_html, 'TM', 'H')
 def internalSender(rcvr_accounts):
     mailman.sendToInbox(None, rcvr_accounts[0].username, subject, html_message, 'SA', 'H')
Beispiel #7
0
def createUser(username, name, password, email, country, industry_category='Software/IT', experience=0, invitation=None):
    username = username.lower()
    
    #add some transactions here?
    account = models.Account()
    account.username = username
    account.name = name
    account.password = dataplus.hash(password)
    account.email = email
    account.account_type = 'U'
    account.account_state = 'A'
    account.save()
    
    user = models.User()
    user.account = account
    user.username = username
    user.name = name
    user.email = email
    user.last_access_time = datetime.datetime.utcnow()
    user.last_update_time = datetime.datetime.utcnow()
    user.resume_update_time = config.min_date
    
    #some defaults for the images
    user.image_file_path = config.noimg
    user.image_size1_file_path = config.noimg_50
    user.image_size2_file_path = config.noimg_72
    user.image_size3_file_path = config.noimg_128    

    resume_contents = models.ResumeContents()
    resume_contents.text = 'Resume not uploaded yet.'
    resume_contents.masked_text = 'Resume not uploaded yet.'
    resume_contents.html_style = ''
    resume_contents.html_formatter = ''
    resume_contents.save()
    user.resume_contents = resume_contents            
    
    #Empty vessels make more noise
    user.phone = ''
    user.personal_desc = ''
    user.small_desc = ''
    user.blog_url = ''
    user.hilite = ''
    user.resume_dir = ''
    user.salary_range_lower = 0
    user.salary_range_upper = 0
    user.working_since = datetime.datetime.utcnow() - datetime.timedelta(experience * 365)
    
    user.industry_category = models.IndustryCategory.objects.get(name=industry_category)
    
    #save maadi!
    user.save()

    user_settings = models.UserSettings()
    user_settings.email_fwd_messages = False
    user_settings.email_fwd_jobrefs = True
    user_settings.email_fwd_alerts = True
    user_settings.phone_num_visibility = 'friends'
    user_settings.resume_visibility = 'everyone'
    user_settings.interest_in_new_job = 'active'
    user_settings.preferred_location = 'Anywhere'
    user_settings.original_resume_format = ''
    user_settings.available_resume_download_formats = ''
    user_settings.preferred_resume_download_format = 'pdf'
    user_settings.resume_download_format_set = False
    user_settings.enable_voip_dial = True
    user_settings.country = country
    user_settings.currency = statix.country_currency_map[user_settings.country]
    user_settings.user = user
    user_settings.save()
    
    chat_settings = models.ChatSettings()
    chat_settings.account = account
    chat_settings.online_status = 'everyone'
    chat_settings.custom_message = ''
    chat_settings.invite_preference = 'friends'
    chat_settings.ignore_list = ''
    chat_settings.image_size1_file_path = config.noimg_50
    chat_settings.image_size2_file_path = config.noimg_72
    chat_settings.image_size3_file_path = config.noimg_128
    chat_settings.save()

    matching_jobs = models.MatchingJobs()
    matching_jobs.user = user
    matching_jobs.jobs = ''
    matching_jobs.save()
    
    mru_data = models.UserMRUData()
    mru_data.last_accessed_time = datetime.datetime.utcnow()
    mru_data.user = user
    mru_data.save()
    
    mail1_subject = 'Let\'s get started with Socialray'
    mail1_body_html = '<p>Welcome to Socialray.</p><p>Some of the things you can try out on Socialray:<br />' + \
                    ' - Making your Resume searchable through Google<br />' + \
                    ' - <a href="/me/searchpeople.htm">Find friends</a> and other connections<br />' + \
                    ' - Join <a href="/me/searchcommunities.htm">Interesting Communities</a><br />' + \
                    ' - Add credibility to your resume with <a href="/profiles/' + user.username + '/">Testimonials</a><br />' + \
                    ' - Refer jobs to your Friends and Communities<br />' + \
                    ' - Chat with your friends using Socialray Web Chat<br />' + \
                    ' - You can even <a href="/me/editmedia.htm">attach videos</a> to your resume</p>' + \
                    '<p>Socialray is learning. And we are evolving with new features. So keep checking.</p>' + \
                    '<p>Regards,<br />Socialray Team</p>'            
    
    mail1_body_text = 'Welcome to Socialray. \r\n\r\n Some of the things you can try out on Socialray:\r\n' + \
                    ' - Making your Resume searchable through Google\r\n' + \
                    ' - Find friends and other connections\r\n' + \
                    ' - Join Interesting Communities\r\n' + \
                    ' - Add credibility to your resume with Testimonials\r\n' + \
                    ' - Refer jobs to your Friends and Communities\r\n' + \
                    ' - Chat with your friends using Socialray Web Chat\r\n' + \
                    ' - You can even attach videos to your resume\r\n\r\n' + \
                    'Socialray is learning. And we are evolving with new features. So keep checking.\r\n\r\n' + \
                    'Regards,\r\nSocialray Team\r\n\r\n'

    mail1_body_html_external = '<p>Welcome to Socialray.</p><p>Some of the things you can try out on Socialray:<br />' + \
                    ' - Making your Resume searchable through Google<br />' + \
                    ' - <a href="http://www.socialray.org/me/searchpeople.htm">Find friends</a> and other connections<br />' + \
                    ' - Join <a href="http://www.socialray.org/me/searchcommunities.htm">Interesting Communities</a><br />' + \
                    ' - Add credibility to your resume with <a href="http://www.socialray.org/profiles/' + user.username + '/">Testimonials</a><br />' + \
                    ' - Refer Jobs to your Friends and Communities<br />' + \
                    ' - Chat with your friends using Socialray Web Chat<br />' + \
                    ' - You can even <a href="http://www.socialray.org/me/editmedia.htm">Attach Videos</a> to your resume</p>' + \
                    '<p>Socialray is learning. And we are evolving with new features. So keep checking.</p>' + \
                    '<p>Regards,<br />Socialray Team</p>'                             
                    
    mailman.sendToInbox(None, user.username, mail1_subject, mail1_body_html, 'SA')
    mailman.sendOneWayMail('Socialray ' + config.system_email, ['"' + user.name + '" <' + user.email + '>'], mail1_subject, mail1_body_html_external, 
        None, None, mail1_body_text)
    
    mail2_subject = 'Take a tour'
    mail2_body_html = '<p>Socialray has added some really exciting features,  like the new chat system, yahoo and skype integration and better communities.</p>' + \
                    '<p>We have created the <a href="/tour.html">socialray tour</a>, to show you all that.</p>' + \
                    '<p>Regards,<br />Socialray Team</p>'
    mail2_body_text = 'Socialray has added some really exciting features,  like the new chat system, yahoo and skype integration and better communities.\r\n\r\n' + \
                    'We have created the socialray tour at http://www.socialray.org/tour.html, to show you all that.\r\n\r\n' + \
                    'Regards,\r\nSocialray Team\r\n\r\n'
    mailman.sendToInbox(None, user.username, mail2_subject, mail2_body_html, 'SA')
    mailman.sendOneWayMail('Socialray ' + config.system_email, ['"' + user.name + '" <' + user.email + '>'], mail2_subject, mail2_body_html, 
        None, None, mail2_body_text)

    if invitation:
        post_signup_actions = models.PostSignupActions(user=user)
        post_signup_actions.actions = invitation
        post_signup_actions.save()
    
    return user
 def internalSender(rcvr_accounts):
     mailman.sendToInbox(
         myself.username, rcvr_accounts[0].username, "A question for you!", html_message, "TM", "H"
     )
 def internalSender(rcvr_accounts):
     for rcvr_account in rcvr_accounts:
         mailman.sendToInbox(None, rcvr_account.username, subject, html_message, 'SA')