# Generate a secret key for encryption secret_key = Fernet.generate_key() cipher_suite = Fernet(secret_key)
function App() { const [passwordLength, setPasswordLength] = useState(12); const [generatedPassword, setGeneratedPassword] = useState(""); const [accountName, setAccountName] = useState(""); const [password, setPassword] = useState(""); const [masterPassword, setMasterPassword] = useState("");
app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://user:password@host:port/dbname" db = SQLAlchemy(app) scoreland passwords
class Password(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False) account_name = db.Column(db.String(128), nullable=False) password = db.Column(db.String(128), nullable=False)
const handleStorePassword = async () => { try { const response = await axios.post("http://localhost:5000/store_password", { user_id: 1, account_name: accountName, password: generatedPassword, }); console.log(response.data); } catch (error) { console.error(error); } }; # Generate a secret key for encryption secret_key = Fernet
return ( <div> <h1>ScoreLand Password Manager</h1> <input type="number" value={passwordLength} onChange={(e) => setPasswordLength(e.target.value)} placeholder="Password length" /> <button onClick={handleGeneratePassword}>Generate Password</button> <p>Generated Password: {generatedPassword}</p> <input type="text" value={accountName} onChange={(e) => setAccountName(e.target.value)} placeholder="Account name" /> <button onClick={handleStorePassword}>Store Password</button> <input type="password" value={masterPassword} onChange={(e) => setMasterPassword(e.target.value)} placeholder="Master password" /> <button onClick={handleRetrievePassword}>Retrieve Password</button> </div> ); }
class User(db.Model): id = db.Column(db.Integer, primary_key=True) master_password = db.Column(db.String(128), nullable=False) setPasswordLength] = useState(12)
const handleRetrievePassword = async () => { try { const response = await axios.post("http://localhost:5000/retrieve_password", { user_id: 1, account_name: accountName, master_password: masterPassword, }); console.log(response.data); } catch (error) { console.error(error); } };