input: Write a python function to register and login users in a Flask application using SQLAlchemy.
  assert register_user({"username": "user1", "password": "pass1"}) == {"message": "User user1 was successfully created!"}
  assert login_user({"username": "user1", "password": "pass1"}) == {"message": "User user1 is successfully logged in!"}
  assert login_user({"username": "user1", "password": "wrongpass"}) == {"message": "Invalid credentials"}
output: from flask import Flask, request, jsonify
  from flask_sqlalchemy import SQLAlchemy
  from werkzeug.security import generate_password_hash, check_password_hash
  
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'
  app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
  db = SQLAlchemy(app)
  
  class User(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(80), unique=True, nullable=False)
      password = db.Column(db.String(200), nullable=False)
  
  db.create_all()
  
  def register_user(data):
      username = data.get('username')
      password = data.get('password')
      
      if not username or not password:
          return {"message": "Username and password are required"}
  
      existing_user = User.query.filter_by(username=username).first()
      if existing_user:
          return {"message": "User already exists"}
      
      hashed_password = generate_password_hash(password, method='sha256')
      new_user = User(username=username, password=hashed_password)
      db.session.add(new_user)
      db.session.commit()
      
      return {"message": f"User {username} was successfully created!"}
  
  def login_user(data):
      username = data.get('username')
      password = data.get('password')
      
      if not username or not password:
          return {"message": "Username and password are required"}
      
      user = User.query.filter_by(username=username).first()
      if user and check_password_hash(user.password, password):
          return {"message": f"User {username} is successfully logged in!"}
      else:
          return {"message": "Invalid credentials"}