Home / Expert Answers / Computer Science / need-help-to-ensure-password-complexity-is-enforced-current-code-app-py-from-datetime-import-date-pa984

(Solved): Need help to ensure password complexity is enforced current code app.py from datetime import date ...



Need help to ensure password complexity is enforced

This exercise uses your programming environment to enhance the Web site you created
last week with additional functionality t

current code

app.py

from datetime import date

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')

@app.route('/index.html')

def home():

return render_template('index.html', date = date.today() )

@app.route('/page2.html')

def page2():

return render_template('page2.html', date = date.today() )

@app.route('/page3.html')

def page3():

return render_template('page3.html', date = date.today() )

if __name__ == '__main__':

app.run(debug = True)



index.html

<html>

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index Page</title>

<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/style.css') }}">

</head>

    <style>
        img{
            height:500px;
            width:1500px;
        }
        table,td{
            border: 1px solid black;
        }
        form{
            display:flex;
            flex-direction:column;
        }
        button{
            width:200px;
        }
        .login-form{
            width:300px;
        }
        input{
            margin:5px;
            padding:10px;
        }
    </style>

    <script>
        function isStrongPwd(password){
            var regExp = /(?=.*\d)(?=.*[a-z])(?=.*[!@#$%&*()]).{12,}/;
            var validPassword = regExp.test(password)
            return validPassword;
        }
    </script>
<body>

<h1>Page 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<div class="separate">

<ol>

<li>One</li>

<li>Two</li>

</ol>

</div>

<div class="separate">

<ul>

<li>One</li>

<li>Two</li>

</ul>

</div>

<h1>Images section</h1>

<div>

<img src="im1.jpg" alt ="image1">

<img src="im2.jpg" alt ="image2">

<img src="im3.jpg" alt = "image3">

<img src="im4.jpg" alt ="image4">

</div>

<h1>Table section</h1>

<div>

<table>

<tr>

<td>row1column1</td>

<td>row1column2</td>

<td>row1column3</td>

</tr>

<tr>

<td>row2column1</td>

<td>row2column2</td>

<td>row2column3</td>

</tr>

<tr>

<td>row3column1</td>

<td>row3column2</td>

<td>row3column3</td>

</tr>

<tr>

<td>row4column1</td>

<td>row4column2</td>

<td>row4column3</td>

</tr>

</table>

</div>

<h1>User Registration form</h1>

<div>

<form>

<h3>Register</h3>

<p>Please fill in this form to create an account.</p>

<div>

<label for="email"><b>Email</b></label>

<input type="text" placeholder="Enter Email" name="email" id="email" required>

</div>

<div>

<label for="psw"><b>Password</b></label>

<input type="password" placeholder="Enter Password" name="psw" id="psw" required>

</div>

<div>

<label for="psw-repeat"><b>Repeat Password</b></label>

<input type="password" placeholder="Repeat Password" name="psw-repeat" id="psw-repeat" required>

</div>

<button type="submit" class="registerbtn">Register</button>

</form>

</div>

<h1>Login form</h1>

<form class="login-form">

<input type="text" placeholder="Username">

<input type="password" placeholder="Password">

<input type ="button" value="Login" onclick="isStrongPwd()">

</form>

<!--Display the date passed from python-->

<p>Today is {{date}}</p>

<br>

<a href="https://www.google.com">Visit Site1</a>

<a href="https://www.google.com">Visit Site2</a>

<a href="https://www.google.com">Visit Site3</a>

<br>

<a href="/page2.html">Page 2</a>

<a href="/page3.html">Page 3</a>

</body>

</html>



page2.html

<html>

<head>

<title>Page 2</title>

<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/style.css') }}">

</head>

<body>

<h1>Page 2</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<div class="separate">

<ol>

<li>One</li>

<li>Two</li>

</ol>

</div>

<div class="separate">

<ul>

<li>One</li>

<li>Two</li>

</ul>

</div>

<!--Display the date passed from python-->

<p>Today is {{date}}</p>

<br>

<a href="https://www.google.com">Visit Site1</a>

<a href="https://www.google.com">Visit Site2</a>

<a href="https://www.google.com">Visit Site3</a>

<br>

<a href="/index.html">Home Page</a>

<a href="/page3.html">Page 3</a>

</body>

</html>




page3.html

<html>

<head>

<title>Page 3</title>

<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/style.css') }}">

</head>

<body>

<h1>Page 3</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<div class="separate">

<ol>

<li>One</li>

<li>Two</li>

</ol>

</div>

<div class="separate">

<ul>

<li>One</li>

<li>Two</li>

</ul>

</div>

<!--Display the date passed from python-->

<p>Today is {{date}}</p>

<br>

<a href="https://www.google.com">Visit Site1</a>

<a href="https://www.google.com">Visit Site2</a>

<a href="https://www.google.com">Visit Site3</a>

<br>

<a href="/index.html">Home Page</a>

<a href="/page2.html">Page 3</a>

</body>

</html>


<head>
<title>Page 3</title>
<link rel=stylesheet type=text/css href={{ url_for(static,filename

style.css

.separate{

margin-top: 10px;

}

 

This exercise uses your programming environment to enhance the Web site you created last week with additional functionality to include images, tables and a Form using Python flask. Specifically, you will add two (2) additional routes allowing a user to register and login to a web site. Additional security considerations include other routes (beyond the register route) will not be accessible until a successful login has occurred. In addition to the requirements list above the following functionality should be found within your web site on one or more web pages. Add at least 4 different images. The images should be local in your environment. For example, they should be saved in your environment and referenced similar to this syntax: A Table with at least 4 rows and 3 columns. A user registration form A user login form A password complexity should be enforced to include at least 12 characters in length, and include at least 1 uppercase character, 1 lowercase character, 1 number and 1 special character. The content and topic of the new images, and tables are up to you. How much is required for the user registration is up to you as well. However, the registration and associated login should contain at least a login name and password.


We have an Answer from Expert

View Expert Answer

Expert Answer


Solution :: Step 1 The HTML Code       Document
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe