Ejemplo n.º 1
0
 def post(self, request, *args, **kwargs):
     email = request.POST["email"]
     fb_id = request.POST["fb_id"]
     activation_key = GetStartedForm.generate_activation_key(email)
     reg_pro = RegistrationProfile(email=email,
                                   facebook_id=fb_id,
                                   client_ip=request.META["REMOTE_ADDR"],
                                   client_host=request.META["REMOTE_HOST"],
                                   activation_key=activation_key,
                                   joined_via_fb=True)
     reg_pro.save()
     return redirect("account_activate", activation_key=activation_key)
Ejemplo n.º 2
0
    def form_valid(self, form):
        email = form.cleaned_data['email']
        activation_key = form.generate_activation_key(email)
        reg_pro = RegistrationProfile(
            email=email,
            client_ip=self.request.META["REMOTE_ADDR"],
            client_host=self.request.META["REMOTE_HOST"],
            activation_key=activation_key,
        )
        reg_pro.save()

        act_link = self.request.build_absolute_uri("/account/activate/%s" %
                                                   activation_key)

        if settings.DEBUG:
            messages.info(self.request,
                          "Email sent to %s with link %s" % (email, act_link))

        self.send_confirmation(email, activation_key, act_link)
        return super(FormView, self).form_valid(form)
Ejemplo n.º 3
0
 def save(self, domain_override=""):
     source = web.input()
     """
     Create the new ``User`` and ``RegistrationProfile``, and
     returns the ``User`` (by calling
     ``RegistrationProfile.objects.create_inactive_user()``).
     
     """
     new_user = RegistrationProfile.create_inactive_user(
         username=source["username"],
         password=source["password"],
         email=source["email"],
         domain_override=domain_override,
     )
     return new_user
Ejemplo n.º 4
0
Archivo: app.py Proyecto: miku/evreg
def register():
	form = RegistrationForm()
	if form.validate_on_submit():
		profile = RegistrationProfile()
		profile.first_name = unicode(form.first_name.data)
		profile.last_name = unicode(form.last_name.data)
		profile.email = unicode(form.email.data)
		profile.password = unicode(generate_password_hash(form.password.data))
		profile.ip_address = unicode(request.remote_addr)
		profile.dob = form.dob.data
		profile.identifier_id= unicode(form.identifier_id.data)
		profile.country = unicode(form.country.data)
		profile.zipcode = unicode(form.zipcode.data)
		profile.city = unicode(form.city.data)
		profile.street = unicode(form.street.data)
		
		profile.username = profile.email
		
		db_session.add(profile)
		db_session.commit()
		# TODO, send email!
		
		with mail.record_messages() as outbox:					
			msg = Message("IALT Registration",
				sender=("IALT Registration", "*****@*****.**"),
				recipients=[profile.email])
			msg.body = "Please activate your Profile under {0}".format(profile.activation_key)
			mail.send(msg)
			
			assert len(outbox) == 1
			assert outbox[0].subject == "IALT Registration"
			assert profile.email in outbox[0].recipients
		
		flash("Registration completed. We've sent you an E-Mail with your activation key.")
		print profile.activation_key
		return redirect(url_for('index'))
	return render_template("auth/register.html", form=form)