feat: Add delete client api
All checks were successful
Build Docker / Build Docker (push) Successful in 1m17s

This commit is contained in:
Nathan Woodburn 2024-02-13 22:46:46 +11:00
parent 49f23261c3
commit 61b3e900de
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -99,6 +99,21 @@ def create_client():
db.session.commit() db.session.commit()
return redirect('/') return redirect('/')
@bp.route('/delete_client')
def delete_client():
user = current_user()
if not user:
return redirect('/')
if user.id != 1:
return redirect('/')
client_id = request.args.get('client_id')
client = OAuth2Client.query.filter_by(client_id=client_id).first()
if client:
db.session.delete(client)
db.session.commit()
return redirect('/')
@bp.route('/oauth/authorize', methods=['GET', 'POST']) @bp.route('/oauth/authorize', methods=['GET', 'POST'])
def authorize(): def authorize():