mirror of
				https://github.com/assenzostefano/class-website.git
				synced 2025-06-06 00:39:12 +02:00 
			
		
		
		
	Reorder some file
This commit is contained in:
		
							
								
								
									
										12
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								app.py
									
									
									
									
									
								
							| @@ -94,7 +94,7 @@ def register(): | |||||||
|             user_data = records.find_one({"email": email}) |             user_data = records.find_one({"email": email}) | ||||||
|             new_email = user_data['email'] |             new_email = user_data['email'] | ||||||
|             #if registered redirect to logged in as the registered user |             #if registered redirect to logged in as the registered user | ||||||
|             return render_template('logged_in.html', email=new_email) |             return render_template('logged_in/logged_in.html', email=new_email) | ||||||
|     return render_template('index.html') |     return render_template('index.html') | ||||||
|  |  | ||||||
| @app.route("/login", methods=["POST", "GET"]) | @app.route("/login", methods=["POST", "GET"]) | ||||||
| @@ -120,17 +120,17 @@ def login(): | |||||||
|                 if "email" in session: |                 if "email" in session: | ||||||
|                     return redirect(url_for("logged_in")) |                     return redirect(url_for("logged_in")) | ||||||
|                 message = 'Wrong password' |                 message = 'Wrong password' | ||||||
|                 return render_template('login.html', message=message) |                 return render_template('login/login.html', message=message) | ||||||
|         else: |         else: | ||||||
|             message = 'Email not found' |             message = 'Email not found' | ||||||
|             return render_template('login.html', message=message) |             return render_template('login/login.html', message=message) | ||||||
|     return render_template('login.html', message=message) |     return render_template('login/login.html', message=message) | ||||||
|  |  | ||||||
| @app.route('/logged_in') | @app.route('/logged_in') | ||||||
| def logged_in(): | def logged_in(): | ||||||
|     if "email" in session: |     if "email" in session: | ||||||
|         email = session["email"] |         email = session["email"] | ||||||
|         return render_template('logged_in.html', email=email) |         return render_template('logged_in/logged_in.html', email=email) | ||||||
|     else: |     else: | ||||||
|         return redirect(url_for("login")) |         return redirect(url_for("login")) | ||||||
|  |  | ||||||
| @@ -138,7 +138,7 @@ def logged_in(): | |||||||
| def logout(): | def logout(): | ||||||
|     if "email" in session: |     if "email" in session: | ||||||
|         session.pop("email", None) |         session.pop("email", None) | ||||||
|         return render_template("signout.html") |         return render_template("signout/signout.html") | ||||||
|     else: |     else: | ||||||
|         return render_template('index.html') |         return render_template('index.html') | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,54 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="en"> |  | ||||||
| <head> |  | ||||||
|   <title>Login with mongodb flask</title> |  | ||||||
|  |  | ||||||
|   <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> |  | ||||||
|   <link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet"> |  | ||||||
|   <link href="../static/signup.css" rel="stylesheet"> |  | ||||||
|  |  | ||||||
| </head> |  | ||||||
|  |  | ||||||
| <body> |  | ||||||
|  |  | ||||||
| <div class="container"> |  | ||||||
|   <div class="header"> |  | ||||||
|     <nav> |  | ||||||
|       <ul class="nav nav-pills pull-right"> |  | ||||||
|         <li role="presentation" ><a href="/main">Home</a></li> |  | ||||||
|         <li role="presentation"><a href="/signin">Sign In</a></li> |  | ||||||
|         <li role="presentation" class="active"><a href="#">Sign Up</a></li> |  | ||||||
|       </ul> |  | ||||||
|     </nav> |  | ||||||
|     <h3 class="text-muted">Login with mongodb flask</h3> |  | ||||||
|   </div> |  | ||||||
|  |  | ||||||
|   <div class="jumbotron"> |  | ||||||
|     <h1>Signup</h1> |  | ||||||
|     {% with messages = get_flashed_messages() %} |  | ||||||
|     {% if messages %} |  | ||||||
|     <ul class=flashes> |  | ||||||
|       {% for message in messages %} |  | ||||||
|       <li>{{ message }}</li> |  | ||||||
|       {% endfor %} |  | ||||||
|     </ul> |  | ||||||
|     {% endif %} |  | ||||||
|     {% endwith %} |  | ||||||
|     <form class="form-signin" action="/signup" method="post"> |  | ||||||
|       <label for="inputName" class="sr-only">Username</label> |  | ||||||
|       <input type="name" name="username" id="inputName" class="form-control" placeholder="Username" required autofocus> |  | ||||||
|       <label for="inputEmail" class="sr-only">Email address</label> |  | ||||||
|       <input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus> |  | ||||||
|       <label for="inputPassword" class="sr-only">Password</label> |  | ||||||
|       <input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required> |  | ||||||
|       <button id="btnSignUp" class="btn btn-lg btn-primary btn-block" onclick = 'this.form.submit();' type="button">Signup</button> |  | ||||||
|     </form> |  | ||||||
|   </div> |  | ||||||
|  |  | ||||||
|   <footer class="footer"> |  | ||||||
|     <p>© 2017</p> |  | ||||||
|   </footer> |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
		Reference in New Issue
	
	Block a user