def post(self):
        """Deals with submitting the form."""
        # Get information from the post request
        username = self.request.get("username")
        password = self.request.get("password")

        if "guestLogin" in self.request.POST:
            username = "******"
            password = "******"

        user = db.GqlQuery("SELECT * FROM User WHERE username=:username", username=username).get()
        if user:
            # checks if the username and password are valid
            if validation.valid_pw(user.username, password, user.passHash):
                user_id = user.key().id()

                # Makes and adds the cookie
                self.response.headers["Content-Type"] = "text/plain"
                user_id_val = validation.make_secure_val(str(user_id))
                self.response.headers.add_header("Set-Cookie", str("user=%s; Path=/" % user_id_val))
                self.response.headers.add_header(
                    "Set-Cookie", str("is_user_activated=%s; Path=/" % str(user.activated))
                )

                next_url = self.request.get("next")
                self.redirect(next_url if next_url else "/home")
            #                 self.redirect("home")
            else:
                self.write_form(error="Invalid Password", username=username)
        else:
            self.write_form(error="User doesn't exist")
	def post(self):
		user_username = self.request.get('username')
		user_password = self.request.get('password')
		user_verify = self.request.get('verify')
		user_email = self.request.get('email')
		venmo_email = self.request.get('venmo_email')
		bio = self.request.get('bio')

		username = validation.username(user_username)
		password = validation.password(user_password)
		verify = validation.verify(user_verify, user_password)
		email = validation.edu_email(user_email)
		venmo_email_verify = validation.email(venmo_email)

		userError=""
		passError=""
		verifyError=""
		emailError=""
		venmoEmailError = ""
		if not username:
			userError = "That's not a valid username."
			user_username=""
		if not password:
			passError = "That wasn't a valid password."
		if not verify:
			verifyError = "Your passwords didn't match."
		if not email:
			emailError = "That's not a valid email."
			user_email=""
		if venmo_email != "" and venmo_email_verify is None:
			venmoEmailError = "That's not a valid email. Leave empty if you don't have one"
			venmo_email=""
		
		if username and password and verify and email and (venmoEmailError == ""):
			passHash = validation.make_pw_hash(username, password)
			code = validation.make_salt()

			user = User(username = username, passHash=passHash, email=email, bio=bio, venmo_email=venmo_email, activationCode=code)
				
			u = User.all().filter('username ='******'Content-Type'] = 'text/plain'
			cookie_val = validation.make_secure_val(str(user_id))
			self.response.headers.add_header('Set-Cookie',str('user=%s; Path=/' % cookie_val))
			self.sendActivationEmail(email, code)
			self.redirect("/home")
		else:
			self.write_form(userError, passError, verifyError, emailError, venmoEmailError,
						user_username, user_email, bio=bio)