()
return render_template('user/signup.html', data=data, form=form)
User Sign up page: Very basic email + password
    sign up form that will also login users.
User Sign up page: Very basic email + password
    sign up form that will also login users.
User Sign up page : Very basic email + password sign up form that will also login users .
def signup():
    '''
    User Sign up page: Very basic email + password
    sign up form that will also login users.
    '''
    # Data is used throughout for the jinja2 templates
    data = {
        'active': "signup",  # Sets the current page
        'loggedin': False  # Don't show the logout link
    }

    # Define the SignupForm
    form = SignupForm(request.form)
    # Validate and then create userdata
    if request.method == "POST":
        if form.validate():
            # Take form data
            email = form.email.data
            password = form.password.data
            company = form.company.data
            contact = form.contact.data
            userdata = {
                'username': email,
                'email': email,
                'password': password,
                'company': company,
                'contact': contact
            }

            # Create user
            user = User()
            user.config = app.config
            result = user.createUser(userdata, g.rdb_conn)
            # Check results for success or failure
            if result == "exists":
                flash('User already exists.', 'danger')
            elif result is not False:
                try:
                    stathat.ez_count(
                        app.config['STATHAT_EZ_KEY'],
                        app.config['ENVNAME'] + ' User Signup', 1)
                except:
                    pass
                print("/signup - New user created")
                cdata = cookies.genCdata(result, app.config['SECRET_KEY'])
                data['loggedin'] = True
                flash('You are signed up.', 'success')

                # Generate confirmation token
                generate_confirmation_token(email, result, time.time())

                # Build response
                resp = make_response(redirect(url_for('member.dashboard_page')))
                timeout = int(time.time()) + int(app.config['COOKIE_TIMEOUT'])
                # Set the cookie secure as best as possible
                resp.set_cookie(
                    'loggedin', cdata, expires=timeout, httponly=True)
                return resp
        else:
            stathat.ez_count(
                app.config['STATHAT_EZ_KEY'],
                app.config['ENVNAME'] + ' False User Signup', 1)
            print("/signup - False user creation")
            flash('Form is not valid.', 'danger')

    # Return Signup Page
    return render_template('user/signup.html', data=data, form=form)
def signup ( ) : # Data is used throughout for the jinja2 templates data = { 'active' : "signup" , # Sets the current page 'loggedin' : False # Don't show the logout link } # Define the SignupForm form = SignupForm ( request . form ) # Validate and then create userdata if request . method == "POST" : if form . validate ( ) : # Take form data email = form . email . data password = form . password . data company = form . company . data contact = form . contact . data userdata = { 'username' : email , 'email' : email , 'password' : password , 'company' : company , 'contact' : contact } # Create user user = User ( ) user . config = app . config result = user . createUser ( userdata , g . rdb_conn ) # Check results for success or failure if result == "exists" : flash ( 'User already exists.' , 'danger' ) elif result is not False : try : stathat . ez_count ( app . config [ 'STATHAT_EZ_KEY' ] , app . config [ 'ENVNAME' ] + ' User Signup' , 1 ) except : pass print ( "/signup - New user created" ) cdata = cookies . genCdata ( result , app . config [ 'SECRET_KEY' ] ) data [ 'loggedin' ] = True flash ( 'You are signed up.' , 'success' ) # Generate confirmation token generate_confirmation_token ( email , result , time . time ( ) ) # Build response resp = make_response ( redirect ( url_for ( 'member.dashboard_page' ) ) ) timeout = int ( time . time ( ) ) + int ( app . config [ 'COOKIE_TIMEOUT' ] ) # Set the cookie secure as best as possible resp . set_cookie ( 'loggedin' , cdata , expires = timeout , httponly = True ) return resp else : stathat . ez_count ( app . config [ 'STATHAT_EZ_KEY' ] , app . config [ 'ENVNAME' ] + ' False User Signup' , 1 ) print ( "/signup - False user creation" ) flash ( 'Form is not valid.' , 'danger' ) # Return Signup Page return render_template ( 'user/signup.html' , data = data , form = form )