exp_no = 1 user.experiment = Experiment.objects.get(id=exp_no) #user.wesabe_id = request.POST['wesabe_id'] user.pin = hashlib.sha224(request.POST['pin']).hexdigest() user.phone = request.POST['phone'] user.save() profile.user = user profile.save() s_profile,created = SharingProfile.objects.get_or_create(user=user) log.info("Added user and profile for %s!" % request.facebook.uid) consent = OTNConsent(user=user, otn=request.POST['otnconsent']) consent.save() # DEFAULT CODE COMMENTED OUT '''user, created = OTNUser.objects.get_or_create(username=request.POST['username']) user.email = request.POST['email'] user.proxy_email = profile.email user.first_name = profile.first_name user.last_name = profile.last_name user.name = profile.full_name user.fb_image = profile.picture_url user.phone = request.POST.get('phone', '617-999-9999') # assign user to experiment num_exp = Experiment.objects.all().count()
exp_no = 1 user.experiment = Experiment.objects.get(id=exp_no) user.mit_id = request.POST['mit_id'] user.pin = hashlib.sha224(request.POST['pin']).hexdigest() user.my_email = request.POST['email'].lower() user.phone = request.POST['phone'] user.save() profile.user = user profile.save() s_profile,created = SharingProfile.objects.get_or_create(user=user) log.info("Added user and profile for %s!" % request.facebook.uid) otnconsent = OTNConsent(user = user, techcash = request.POST['techcashconsent'], read=request.POST['readconsent'], otn=request.POST['otnconsent']) otnconsent.save() user = authenticate(request=request) login(request, user) """ msg = 'Please add %s to OTN.\nID: %s.\n\n-kwan'%(user.otnuser.name, user.otnuser.mit_id) try: send_mail('New OTN User', msg, '*****@*****.**', ['*****@*****.**', '*****@*****.**'], fail_silently=False) user.otnuser.approved = 1 user.otnuser.save() except smtplib.SMTPException: log.debug("Unable to send e-mail to mitcard for: %s, %s"%(user.otnuser.name, user.otnuser.mit_id)) """ return HttpResponseRedirect(redirect_url) # user setup his/her own local account in addition to their facebook