Question: I need some assistance in adding a logging function to my python flask program. Specifically, I need to add the following: -Password update Form -

I need some assistance in adding a logging function to my python flask program. Specifically, I need to add the following:

-Password update Form - allows a previously registered user to reset their password after they have successfully logged in.

-Logger - log to log all failed login attempts. The Log should include the date, time, and IP address.

Below is my current code:

views.py:

#Import statements

from datetime import datetime

from flask import render_template

from flask import Flask

app = Flask(__name__) #Define app

def current_time():

"""Function to calculate current time"""

now = datetime.now() #Returns current date/time

dt_string = now.strftime ("%m/%d/%Y %H:%M:%S") #Formats the current date/time

return d..;@app.route('/')

def home():

"""Function that renders the home page."""

return render_template('index.html', title='Home Page',

date=current_time() ) #Passes current d..;@app.route('/requirements')

def requirements():

"""Function that renders requirements page"""

return r..;@app.route('/steps')

def steps():

"""Function that renders the steps page"""

return render_template('steps.html',title='Steps' )

stylesheet.css

separator{

margin-top: 12px;

}

table, th, td {

border: 1px solid black;

border-collapse: collapse;

}

th, td {

padding: 5px;

text-align: left;

}

body {

background-color: lightgrey;

}

h1 {

color: blue;

font-family: verdana;

font-size: 300%;

}

h2 {

color: darkgreen;

font-family: verdana;

font-size: 200%;

}

h3 {

color: brown;

font-family: verdana;

font-size: 150%;

}

p {

color: brown;

}

login.html

Python Login Page

Login

Please input your information and click "Login." Click "Register" to register a new account.

{% if error %}

* {{ error }}

{% endif %}

register.html

Python Register Page

Register

Please populate the required information to register for a new account and click "Register." Click "Login" to return to the login screen.

{% if error %}

* {{ error }}

{% endif %}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!