def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument('username') password = self.get_argument('password').encode('utf-8') email = self.get_argument('email') try: now = curtime() username = username.lower() email = email.strip().lower() user = User({ 'username': username, 'email': email, 'date_joined': now }) user.set_password(password) user.validate() save_user(self.db_conn, user) except Exception, e: logging.error('Credentials failed') logging.error(e) return self.render_template('accounts/create.html')
def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument("username") password = self.get_argument("password").encode("utf-8") email = self.get_argument("email") try: now = curtime() username = username.lower() email = email.strip().lower() user = User({"username": username, "email": email, "date_joined": now}) user.set_password(password) user.validate() save_user(self.db_conn, user) except Exception, e: logging.error("Credentials failed") logging.error(e) return self.render_template("accounts/create.html")
def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument('username') password = self.get_argument('password') email = self.get_argument('email') try: u = User.create_user(username, password, email) u.validate() save_user(self.db_conn, u) except Exception, e: logging.error('Credentials failed') logging.error(e) return self.render_template('accounts/create.html')
def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument("username") password = self.get_argument("password") try: u = User.create_user(username, password) u.validate() save_user(self.db_conn, u) except Exception, e: logging.error("Credentials failed") logging.error(e) form_fields = user_form(skip_fields=self.skip_fields, values={"username": username}) return self.render_template("accounts/create.html", form_fields=form_fields)