Exemplo n.º 1
0
 def test_user_emails_are_case_insensitive_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email.upper(), self.password)
     if hasattr(ctx.exception, 'message'):
         self.assertEquals(ctx.exception.message, 'user email is not unique')
     else:
         self.assertEquals(str(ctx.exception), 'user email is not unique')
Exemplo n.º 2
0
def register(request):
	#create_superuser('*****@*****.**', 'password')
	register_success = False
	form = RegistrationForm()
	if request.method == 'POST':
		form = RegistrationForm(request.POST)
		
		if form.is_valid():
			# Check this, change it to email in html template
			# in html, the input element has name as 'username', but we are showing label as email, so we will accept it as 'email'
			email = request.POST.get('username')
			password = request.POST.get('password1')
			
			# There are errors, if the email gets repeated,
			# check, some authentication, if UserValid only then fire a create_user, else, print some error in html
			
			if not user_exists(email):
				create_user(email, password)
			else: # if user exists, then log him in
				# If user created properly, then login
				# This login is NOT WORKING, see y?
				#import django.contrib.auth.views as v
				#v.login(request)
				pass
			
			register_success = True
			# return HttpResponseRedirect("/")
			
		else:
			form = RegistrationForm(request.POST)
	
	d = { 'form': form, "register_success": register_success, }

	#return render(request, "registration/register.html", { 'form': form, })
	return render(request, 'registration/registration.html', d, context_instance=RequestContext(request))
 def test_user_emails_are_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email, self.password)
     if hasattr(ctx.exception, "message"):
         self.assertEquals(ctx.exception.message, "user email is not unique")
     else:
         self.assertEquals(str(ctx.exception), "user email is not unique")
Exemplo n.º 4
0
Arquivo: views.py Projeto: mrjd26/bio
def registration(request):
  """
  a view to handle user registration on site
  ** still needs double user registration error handling
  ** and forgot password ? functionality

  Args: None
  Returns: 
      on valid registration...HttpResponse
      notifiying user to check for confirmation email
  """

  if request.method == 'POST':
    form = login_form(request.POST)
    
    if form.is_valid():
      email = request.POST['email']
      password = request.POST['password']

      #email verification from google
      if not mail.is_email_valid(email):
        # handle a non valid email address here
        pass
      else:
        create_user(email, password)
        
        u = User.objects.get(email = email)
        u.is_active = False
        u.save()
     
        token = uuid.uuid4()
        token = str(token)
        v = Verify(email = email, token = token)
        v.save()

        sender_address = ('Friendly Media Support'
                          '<*****@*****.**>')
        subject = 'Confirm your registration'
        body = ('Thank you fo creating an account!\n'
                'Please confirm your email address'
                'by clicking on the link below:\n %s'
                %('https://group-captain.appspot.com/confirmed?'
                  'email=' + email + '&token=' + token)
               )
        mail.send_mail(sender_address, email, subject, body)

        return HttpResponse('Thanks! A confirmation email has been '
                            'sent to ' + email + '. \n Click the link '
                            'in the email to activate your account.') 

  else:
    form = login_form()
  return render(request, 'login.html', {
                                           'form': form,
                                           'registration': True
                                       })
Exemplo n.º 5
0
def create_fb_user(di):
    pass
    fb_id = di.pop('id')
    email = di.pop("email")
    # user, create = FBUserProfile.objects.get_or_create(pk=fb_id)
    # user, create = User.objects.get_or_create(email=email)

    password = None

    if not user_exists(email):
        create_user(email, password)

    else:
        pass
Exemplo n.º 6
0
def create_fb_user(di):
	pass
	fb_id = di.pop('id')
	email = di.pop("email")
	# user, create = FBUserProfile.objects.get_or_create(pk=fb_id)
	# user, create = User.objects.get_or_create(email=email)

	password = None

	if not user_exists(email):
		create_user(email, password)

	else:
		pass
Exemplo n.º 7
0
 def test_can_create_user_without_email(self):
     settings.ALLOW_EMPTY = True
     # Test creating one user
     try:
         user = create_user('', '')
     except Exception, e:
         self.fail('Could not create users without email: %s' % e.message)
Exemplo n.º 8
0
def daftar(request):
	if request.method == 'POST':
		form = DaftarForm(request.POST)
		if form.is_valid():
			email = form.cleaned_data['email']
			password = form.cleaned_data['password']
			nama = form.cleaned_data['nama']
			nama = nama.title()
			nama_organisasi = form.cleaned_data['organisasi']
			nama_organisasi = nama_organisasi.title()
			if User.objects.filter(email=email):
				return HttpResponse('Email sudah terdaftar')
			user_baru = create_user(email, password)
			profil_baru = user_baru.get_profile()
			profil_baru.nama = nama
			profil_baru.save()
			organisasi_baru = Organisasi.objects.create(nama=nama_organisasi)
			status_baru = Status.objects.create(user=user_baru, organisasi=organisasi_baru)
			user = authenticate(email=email, password=password)
			naskah = naskah_bergabung(nama, nama_organisasi)
			notifikasi = kirim_mailgun(email, 'Selamat Menggunakan Rendefu', naskah)
			if user.is_active:
				login(request, user)
				return redirect('/'+user.organisasi_set.all()[0].kode)
			return HttpResponseRedirect('/'+pelanggan.get_profile().get_organisasi().kode)
	else:
		return HttpResponseRedirect('/')
Exemplo n.º 9
0
def anggota_tambah(request, kode_organisasi):
	organisasi = ambil_organisasi(kode_organisasi)
	if request.method == 'POST':
		form = AnggotaForm(request.POST)
		if form.is_valid():
			email = form.cleaned_data['email']
			if User.objects.filter(email=email):
				pesan = 'Email sudah terdaftar'
				return render(request, 'kesalahan.jade', {
					'pesan': pesan, 
					})
			password = '******'
			user_baru = create_user(email, password)
			nama = form.cleaned_data['nama']
			nama = nama.title()
			profil_baru = user_baru.get_profile()
			profil_baru.nama = nama
			profil_baru.save()
			status_baru = Status.objects.create(user=user_baru, organisasi=organisasi)
			return redirect('/')
		else:
			return HttpResponse('salah')
	else:
		form = AnggotaForm()
	return render(request, 'anggota_tambah.jade',{
		'organisasi': organisasi,
		'form': form,
		})
Exemplo n.º 10
0
def make_user(first_name, last_name):
    email = "*****@*****.**" % slugify(first_name)
    user = create_user(email, '1234')
    user.first_name = first_name
    user.last_name = last_name
    user.save()
    return user
Exemplo n.º 11
0
 def setUp(self):
   user = create_user(email="*****@*****.**", password="******")
   self.when = datetime.datetime(2012, 12, 6, 22, 4, 5, 6, timezone.utc)
   new = models.ScheduledUpdates.objects.create(user_id = user,
                                          update = "hey",
                                          publish_date = self.when,
                                          publish_site = 3)
   print new.publish_date.hour
Exemplo n.º 12
0
 def create_lazy_user(self):
     """ Create a lazy user. Returns a 2-tuple of the underlying User
     object (which may be of a custom class), and the username.
     """
     user_class = self.model.get_user_class()
     username = self.generate_username(user_class)
     user = create_user(username, '')
     self.create(user=user)
     return user, username
Exemplo n.º 13
0
 def create_lazy_user(self):
     """ Create a lazy user. Returns a 2-tuple of the underlying User
     object (which may be of a custom class), and the username.
     """
     user_class = self.model.get_user_class()
     username = self.generate_username(user_class)
     user = create_user(username, '')
     self.create(user=user)
     return user, username
Exemplo n.º 14
0
def register(request):
    #create_superuser('*****@*****.**', 'password')
    register_success = False
    form = RegistrationForm()
    if request.method == 'POST':
        form = RegistrationForm(request.POST)

        if form.is_valid():
            # Check this, change it to email in html template
            # in html, the input element has name as 'username', but we are showing label as email, so we will accept it as 'email'
            email = request.POST.get('username')
            password = request.POST.get('password1')

            # There are errors, if the email gets repeated,
            # check, some authentication, if UserValid only then fire a create_user, else, print some error in html

            if not user_exists(email):
                create_user(email, password)
            else:  # if user exists, then log him in
                # If user created properly, then login
                # This login is NOT WORKING, see y?
                #import django.contrib.auth.views as v
                #v.login(request)
                pass

            register_success = True
            # return HttpResponseRedirect("/")

        else:
            form = RegistrationForm(request.POST)

    d = {
        'form': form,
        "register_success": register_success,
    }

    #return render(request, "registration/register.html", { 'form': form, })
    return render(request,
                  'registration/registration.html',
                  d,
                  context_instance=RequestContext(request))
Exemplo n.º 15
0
def create_account(request):
    if request.method == 'POST':
        form = CreateUser(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            user = create_user(
            	email=cd['email'], 
            	password=cd['password'])
            #login_new_user = authenticate(email=user.email, password=user.password)
            return HttpResponseRedirect('/accounts/create_successful/')
    else:
        form = CreateUser()
    return render(request, 'registration/create_account.html', {'form': form})
Exemplo n.º 16
0
def create(request):
	if request.method == 'GET':
		form = EmailUserCreationForm()
		return render_to_response('create.html', {'form':form}, context_instance=RequestContext(request))
	if request.method == 'POST':
		form = EmailUserCreationForm(request.POST)
		if form.is_valid():
			user = create_user(request.POST['email'], request.POST['password1'])
			user.save()
			messages.success(request,'New user successfully created! Go ahead and log in right here.')
			return redirect('/accounts/login')
		else:
			return render_to_response('create.html', {'form':form}, context_instance=RequestContext(request))
Exemplo n.º 17
0
    def setUp(self):
        department = mommy.make('employees.Department',
                                     name='Recursos Humanos')
        self.job_position = mommy.make('employees.JobPosition', name='Gerente')

        user = create_user('*****@*****.**', '1234')
        user.first_name = 'Pedro'
        user.last_name = 'Bandeira'
        user.save()

        mommy.make('employees.Employee', user=user, department=department,
                   status=20, birthday_date=date(1980, 10, 25),
                   job_position=self.job_position)
Exemplo n.º 18
0
def TutorApplication(request, template = 'tutors/tutor_application.html'):
    if not settings.OPEN_SIGNUP:
        return HttpResponseRedirect('/')

    if request.method == 'POST':
        user_creation_form = EmailUserCreationForm(request.POST)
        profile_creation_form = ApplicationForm(request.POST)

        if user_creation_form.is_valid() and profile_creation_form.is_valid():
            # Create the user
            user_data = user_creation_form.cleaned_data
            user = create_user(user_data[ 'email' ], user_data[ 'password1' ])

            try:
                tutors_group = Group.objects.get(name = 'Tutors')
            except Group.DoesNotExist:
                tutors_group = Group.objects.create(name = 'Tutors')

            user.is_staff = False
            user.groups.add(tutors_group)

            profile_data = profile_creation_form.cleaned_data
            user.first_name = profile_data[ 'first_name' ][ 0 ].upper() + profile_data[ 'first_name' ][ 1: ].lower()
            user.last_name = profile_data[ 'last_name' ][ 0 ].upper() + profile_data[ 'last_name' ][ 1: ].lower()
            user.save()

            # Fill the tutor profile
            tutor = Tutor.objects.get(auth=user)
            tutor.name = user.get_full_name()
            tutor.email = user.email
            tutor.phone = profile_data[ 'phone' ]
            tutor.qualifications = profile_data[ 'qualifications' ]
            tutor.rate = profile_data[ 'rate' ]

            for course in profile_data[ 'taught_courses' ]:
                tutor.taught_courses.add(course)
            tutor.save()

            messages.add_message(request, messages.INFO,
                                 'Your application has been successfully received and is pending approval. Thank you '
                                 'for applying for Skule Tutors.')
            return HttpResponseRedirect('/')
    else:
        user_creation_form = EmailUserCreationForm()
        profile_creation_form = ApplicationForm()

    return render_to_response(template,
                              dict(user_creation_form = user_creation_form,
                                   profile_creation_form = profile_creation_form),
                              context_instance = RequestContext(request))
Exemplo n.º 19
0
    def setUp(self):
        department = mommy.make('employees.Department',
                                name='Recursos Humanos')
        job_position = mommy.make('employees.JobPosition', name='Gerente')

        user = create_user('*****@*****.**', '1234')
        user.first_name = 'Pedro'
        user.last_name = 'Bandeira'
        user.save()

        self.employee = mommy.make('employees.Employee', user=user,
                                   department=department, status=20,
                                   birthday_date=date(1980, 10, 25),
                                   job_position=job_position)
Exemplo n.º 20
0
    def setUp(self):
        settings.CELERY_ALWAYS_EAGER = True
        settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True

        department = mommy.make('employees.Department',
                                name='Recursos Humanos')
        job_position = mommy.make('employees.JobPosition', name='Gerente')

        user = create_user('*****@*****.**', '1234')
        user.first_name = 'Pedro'
        user.last_name = 'Bandeira'
        user.save()

        mommy.make('employees.Employee', user=user, department=department,
                   status=20, birthday_date=date(1980, 10, 25),
                   job_position=job_position)
Exemplo n.º 21
0
def register(request):
    if request.method == 'POST':
        email = request.POST['email']
        password = request.POST['password']
        if User.objects.filter(email=email):
            ldr = loader.get_template('oneLiner.html')
            cntxt = RequestContext(request, {
                'request': request,
                'headerfromviews': "Login Response",
                'bodyfromviews': "That email's already taken.",
            })
            return HttpResponse(ldr.render(cntxt))
        else:
            user = create_user(email, password)
            user.save()
            login(request, authenticate(email=email, password=password))
    return redirect('/')
Exemplo n.º 22
0
    def setUp(self):
        settings.CELERY_ALWAYS_EAGER = True
        settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True

        department = mommy.make('employees.Department',
                                name='Recursos Humanos')
        job_position = mommy.make('employees.JobPosition', name='Gerente')

        user = create_user('*****@*****.**', '1234')
        user.first_name = 'Pedro'
        user.last_name = 'Bandeira'
        user.save()

        mommy.make('employees.Employee',
                   user=user,
                   department=department,
                   status=20,
                   birthday_date=date(1980, 10, 25),
                   job_position=job_position)
Exemplo n.º 23
0
def register_page(request):
    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():            
            user = create_user(
                email=form.cleaned_data['email'],
                password=form.cleaned_data['password1'])
            user.first_name = form.cleaned_data['first_name']
            user.last_name = form.cleaned_data['last_name']
            user.save()
            logout(request)
            login(request, authenticate(email=form.cleaned_data['email'], password=form.cleaned_data['password1']))
            request.flash['message'] = ('alert-success', _('Registration completed successfully'))
            return HttpResponseRedirect('/')
    else:
        form = RegistrationForm()

    context = {'form': form, 'active_menu':1}
    return render(request, 'registration/register.html', context)    
Exemplo n.º 24
0
    def create_inactive_user(self, username, email, password,
                             site, send_email=True):
        """
        Create a new, inactive ``User``, generate a
        ``RegistrationProfile`` and email its activation key to the
        ``User``, returning the new ``User``.

        By default, an activation email will be sent to the new
        user. To disable this, pass ``send_email=False``.
        
        """
#        new_user = User.objects.create_user(username, email, password)
        new_user = create_user(email, password)
        new_user.is_active = True
        new_user.save()

        registration_profile = self.create_profile(new_user)

        if send_email:
            registration_profile.send_activation_email(site)

        return new_user
Exemplo n.º 25
0
def create_tourist(request):
        # render a different template based on what type of user is creating the Entrepreneur
    if request.method == 'GET':
            form = CreateTouristForm()
            return render_to_response('peoplefirstapp/tourists/create.html', {'form': form}, context_instance=RequestContext(request))

    elif request.method == 'POST':
        form = CreateTouristForm(request.POST, request.FILES)

        if form.is_valid():
            cleaned_data = form.cleaned_data
            tourist = Tourist(**form.cleaned_tourist_data)
            email = cleaned_data.get('email', None)
            password = cleaned_data.get('password', None)

            tourist.user = create_user(email, password)
            tourist.save()
            return HttpResponseRedirect(reverse('peoplefirstapp:tourist_detail_url', args=[tourist.pk]))

        else:
            return render_to_response('peoplefirstapp/tourists/create.html', {'form': form}, context_instance=RequestContext(request))

    else:
        return HttpResponseNotAllowed(['GET', 'POST'])
Exemplo n.º 26
0
 def save(self, commit=True):
     create_user(self.cleaned_data["email"], password=self.cleaned_data["password1"])
Exemplo n.º 27
0
 def test_user_emails_are_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email, self.password)
     self.assertEquals(ctx.exception.message, 'user email is not unique')
Exemplo n.º 28
0
 def setUp(self):
     self.email = '*****@*****.**'
     self.password = '******'
     self.user = create_user(self.email, self.password)
Exemplo n.º 29
0
 def test_cant_create_users_without_email(self):
     settings.ALLOW_EMPTY = False
     with self.assertRaises(IntegrityError) as ctx:
         create_user('', '')
     self.assertEquals(ctx.exception.message, 'user email is empty')
Exemplo n.º 30
0
 def test_user_emails_are_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email, self.password)
     self.assertEquals(ctx.exception.message, 'user email is not unique')
Exemplo n.º 31
0
 def test_created_user_has_correct_details(self):
     user = create_user(self.email, self.password)
     self.assertEquals(user.email, self.email)
Exemplo n.º 32
0
 def test_can_create_user(self):
     user = create_user(self.email, self.password)
     self.assertEquals(list(User.objects.all()), [user])
Exemplo n.º 33
0
        try:
            serial_number = data['serial_number']
        except:
            serial_number = None

        if serial_number:
            if Device.objects.filter(serial_number=serial_number).exists():
                log.warning('duplicate serial number: %s' % (serial_number))
                raise APIBadRequest(
                    code="duplicate_serial_number",
                    message=_('That serial-number is already used.'))


        # create the user as active
        # separate flag in profile model to track email confirmation
        user = create_user(data['email'], data['password'], is_active=True)

        # hook up with registration
        registration_profile = RegistrationProfile.objects.create_profile(user)
        registration_signals.user_registered.send(sender=self.__class__, user=user, request=request)
        send_activation_email(registration_profile)

        # create device for user
        if serial_number:
            # device, created = Device.objects.get_or_create(profiles__in=[user.pk, ], serial_number=serial_number)
            device, created = Device.objects.get_or_create(serial_number=serial_number, status=2)
        else:
            # no serial provided, so create a 'app' device and generate a serial for it
            device = Device()
            device.generate_serial_number(user.pk)
            device.status = 2
 def test_user_emails_are_case_insensitive_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email.upper(), self.password)
     self.assertEquals(ctx.exception.message,
                       'UNIQUE constraint failed: auth_user.username')
Exemplo n.º 35
0
def fb_data(response):
	"""All these will just return their respective json data"""
	
	accesstoken = response.POST.get('response[authResponse][accessToken]')
	endpoint = pull_user_me()

	url = prepare_url_to_call_graph_api(endpoint, accesstoken)
	resp = call_graph_api_get_data(url)
	di = prepare_json_data(resp)
	

	di['fb_id'] = di.get('id')
	di['accesstoken'] = accesstoken
	di['response'] = str( resp.read() )
	# Settings is_active to True for the moment
	di['is_active'] = True
	
	# if create happens only then create User
	# otherwise, just set session & redirect 
	# u = form.get_or_create()

	#create fbuser
	email = di.pop("email")
	password = "******"

	# If not user, then create
	if not user_exists(email):
		# Create User		
		create_user(email, password)
		user = get_user(email)

		# Create UserProfile
		user_p, cr = UserProfile.objects.get_or_create(user=user)
		# Create FBUserProfile
		fb_user_p = FBUserProfile.objects.filter(user=user, fb_id=di['fb_id'])

		# If not user create a user
		if not fb_user_p:
			form = FBUserProfileForm(di)

			fb_user_p = form.save(commit=False)
			fb_user_p.user = user

			# and not form.errors
			if form.is_bound and form.is_valid():
				#enter fb_id, accesstoken, & then pass the POST variable to see if all fields are filled,
				#& then save, other wise u will hav to manually save each field by doing a save(commit=False)
				form.save(commit=True)

			else:
				print "Some FB Form invalid error errors while logging in."
	else:
		# user = User.objects.filter(email=email)
		# user = user[0]
		user = get_user(email)
		

	#then, #authenticate #&login #& redirect to '/'
	# fb_user = authenticate(email=user.email, password=user.password)
	fb_user = authenticate(email=user.email, password=password)

	if fb_user is not None:
		if fb_user.is_active:
			#login(request, fb_user)
			login(response, fb_user)
			# redirect here
			return HttpResponseRedirect(reverse("stpros.views.list_all"))
		else:
			print "Not active"
	else:
		print 'fb_user is None'

	return di
Exemplo n.º 36
0
 def test_user_emails_are_case_insensitive_unique(self):
     with self.assertRaises(IntegrityError) as ctx:
         create_user(self.email.upper(), self.password)
     self.assertEqual(str(ctx.exception), 'user email is not unique')
Exemplo n.º 37
0
 def test_can_create_user_with_long_email(self):
     padding = 'a' * 30
     create_user(padding + self.email, self.password)
Exemplo n.º 38
0
 def test_can_create_user(self):
     user = create_user(self.email, self.password)
     self.assertEquals(list(User.objects.all()), [user])
Exemplo n.º 39
0
 def setUp(self):
     self.email = '*****@*****.**'
     self.password = '******'
     self.user = create_user(self.email, self.password)
Exemplo n.º 40
0
 def test_can_create_user_with_long_email(self):
     padding = 'a' * 30
     create_user(padding + self.email, self.password)
Exemplo n.º 41
0
 def test_created_user_has_correct_details(self):
     user = create_user(self.email, self.password)
     self.assertEquals(user.email, self.email)
Exemplo n.º 42
0
def gp_data(response):
    """All these will just return their respective json data"""

    di = json.loads(response.POST.get("response"))
    accesstoken = di.get("access_token")
    endpoint = pull_user_me()
    # image = pull_user_image(di)

    url = prepare_url_to_call_graph_api(endpoint, accesstoken)

    resp = call_graph_api_get_data(url)
    di = prepare_json_data(resp)

    di['gid'] = di.get('id')
    di['name'] = ' '.join(di.get("name").values())
    di['gender'] = di.get('gender')
    di['profile_link'] = di.get('url')
    di['accesstoken'] = accesstoken
    di['response'] = str(resp.read())
    di['designation'] = "NA"
    # Settings is_active to True for the moment
    di['is_active'] = True
    # di['avatar'] = image

    # if create happens only then create User
    # otherwise, just set session & redirect
    #create fbuser
    email = None
    for k in di.get("emails"):
        if k['type'] == 'account':
            email = k['value']
    password = "******"

    print "email"
    print email

    # if email is empty throw error
    if not email:
        raise Exception("No email present")

    # =========
    # if user has email id like
    # then redirect to Restricted Email Detected Page
    # then If email not '@samhita.org'
    # again Restricted Email Detected page
    # if not a samhita.org email, again redirect to restricted_emails page

    # if '@samhita.org' not in email:
    # 	return HttpResponseRedirect("/")

    # restricted_emails = [ '*****@*****.**', '*****@*****.**', '*****@*****.**' ]
    # for k in restricted_emails:
    # 	if email in restricted_emails[k]:
    # 		# redirect to restricted_emails page
    # 		return HttpResponseRedirect("/")
    # =========

    # If not user, then create
    if not user_exists(email):
        # Create User
        create_user(email, password)
    # else:
    # 	# user = User.objects.filter(email=email)
    # 	# user = user[0]
    # 	user = get_user(email)

    user = get_user(email)
    response.user = user

    di['avatar'] = pull_user_image(response, di)

    print "user"
    print user

    # Create UserProfile
    user_p, cr = UserProfile.objects.get_or_create(user=user)
    # user_p = UserProfileForm(di, user=user)
    user_p.avatar = di['avatar']
    user_p.save()
    # Create FBUserProfile
    fb_user_p = Guser.objects.filter(user=user, gid=di['gid'])

    # If not user create a user
    if not fb_user_p:
        print "NOT FB"
        form = GuserForm(di)
        print "form"
        print form

        print "errors"
        print form.errors
        fb_user_p = form.save(response, commit=False)
        fb_user_p.user = user

        # and not form.errors
        if form.is_bound and form.is_valid():
            print "isbound isvalid"
            #enter fb_id, accesstoken, & then pass the POST variable to see if all fields are filled,
            #& then save, other wise u will hav to manually save each field by doing a save(commit=False)
            form.save(response, commit=True)

        else:
            print "Some Gplus FOrm invalid error errors while logging in."

    #then, #authenticate #&login #& redirect to '/'
    # fb_user = authenticate(email=user.email, password=user.password)
    fb_user = authenticate(email=user.email, password=password)

    if fb_user is not None:
        if fb_user.is_active:
            print "is active"
            #login(request, fb_user)
            login(response, fb_user)
            # redirect here
            return HttpResponseRedirect(reverse("googleapp.views.list_all"))
        else:
            print "Not active"
    else:
        print 'fb_user is None'

    return di