#NEWLINE# @ auth . route ( '/register' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# def register( ) : #NEWLINE# #INDENT# form = RegistrationForm ( ) #NEWLINE# if form . validate_on_submit ( ) : #NEWLINE# #INDENT# user = User ( email = form . email . data . lower ( ) . strip ( ) , username = form . username . data , password = form . password . data ) #NEWLINE# db . session . add ( user ) #NEWLINE# db . session . commit ( ) #NEWLINE# default_notebook = Notebook ( title = 'Default' , author_id = user . id ) #NEWLINE# db . session . add ( default_notebook ) #NEWLINE# db . session . commit ( ) #NEWLINE# token = user . generate_confirmation_token ( ) #NEWLINE# send_email ( user . email , 'Confirm Your Account' , 'auth/email/confirm' , user = user , token = token ) #NEWLINE# flash ( 'A confirmation email has been sent.' ) #NEWLINE# return redirect ( url_for ( 'main.index' ) ) #NEWLINE# #UNINDENT# return render_template ( 'auth/register.html' , form = form )