def post(self): if self.user: self.redirect(self.uri_for('www-dashboard')) return if self.request.get("password") != self.request.get("confirm_password"): self.redirect(self.uri_for('www-register', error = "Password does not match!.")) return if self.request.get('email') and self.request.get('password') and self.request.get('name'): email = self.request.get('email').strip().lower() name = self.request.get('name').strip() password = self.request.get('password') user = User.query(User.email == email).fetch(1) if user: self.redirect(self.uri_for('www-login', error = "User already exists. Please log in.")) return while True: code_id = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10)) myuser = User.get_by_id(code_id) if not myuser: break user = User(id=code_id) user.password = hash_password(email, password) user.email = email user.name = name user.code_id = code_id user.phonenumber = self.request.get("phonenumber") user.put() self.login(user) if self.request.get('goto'): self.redirect(self.request.get('goto')) else: self.redirect(self.uri_for('www-dashboard')) return else: self.redirect(self.uri_for('www-register', error = "Please enter all the information required."))
def change_information(): user = User() user.phonenumber = request.forms["phonenumber"] user.address = request.forms["address"] session.save(user)