0% found this document useful (0 votes)
4 views1 page

Blaaa Code

This document outlines a Flask web application for an ATM simulator, including routes for home, account creation, login, and dashboard functionalities. It utilizes a User class and an ATMSimulator class to manage user accounts and authentication. The application runs in debug mode and includes session management with a secret key.

Uploaded by

sujalswami0304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Blaaa Code

This document outlines a Flask web application for an ATM simulator, including routes for home, account creation, login, and dashboard functionalities. It utilizes a User class and an ATMSimulator class to manage user accounts and authentication. The application runs in debug mode and includes session management with a secret key.

Uploaded by

sujalswami0304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

from flask import Flask, render_template, request, redirect, url_for, flash

import unittest

app = Flask(__name__)
app.secret_key = 'your_secret_key' # Required for session management

class User:
# (User class remains unchanged)

class ATMSimulator:
# (ATMSimulator class remains unchanged)

# Initialize the ATM simulator


atm = ATMSimulator()

@app.route('/')
def home():
return render_template('home.html')

@app.route('/create_account', methods=['POST'])
def create_account():
username = request.form['username']
pin = request.form['pin']
atm.create_account(username, pin)
return redirect(url_for('home'))

@app.route('/login', methods=['POST'])
def login():
username = request.form['username']
pin = request.form['pin']
atm.authenticate_user(username, pin)
return redirect(url_for('dashboard'))

@app.route('/dashboard')
def dashboard():
if atm.current_user:
return render_template('dashboard.html', user=atm.current_user)
return redirect(url_for('home'))

# Additional routes for deposit, withdraw, check balance, etc.

if __name__ == "__main__":
app.run(debug=True)

You might also like