def index():
error = None<EOL>if g.username:<EOL><INDENT>return to_threads()<EOL><DEDENT>if request.method == '<STR_LIT:POST>':<EOL><INDENT>username = request.form.get('<STR_LIT:username>') or '<STR_LIT>'<EOL>if len(username) > <NUM_LIT:2>:<EOL><INDENT>prefix = current_app.config['<STR_LIT>']<EOL>username_key = USERNAME_KEY.format(prefix)<EOL>session[username_key] = username<EOL>flash('<STR_LIT>'.format(username), '<STR_LIT:success>')<EOL>return to_threads()<EOL><DEDENT>error = True<EOL><DEDENT>status = <NUM_LIT> if error else <NUM_LIT:200><EOL>return make_response(render_template('<STR_LIT>', error=error), status)<EOL>
Setup username and log into the Comments app.