mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 22:47:36 +01:00
Fix two bugs
This commit is contained in:
parent
dd6257a0a0
commit
b296b9b299
@ -36,7 +36,10 @@ class MyModelView(ModelView):
|
|||||||
|
|
||||||
def inaccessible_callback(self, name, **kwargs):
|
def inaccessible_callback(self, name, **kwargs):
|
||||||
# redirect to login page if user doesn't have access
|
# redirect to login page if user doesn't have access
|
||||||
return redirect(url_for('user.login', next=request.url))
|
if current_user.is_authenticated:
|
||||||
|
abort(403)
|
||||||
|
else:
|
||||||
|
return redirect(url_for('user.login', next=request.url))
|
||||||
|
|
||||||
admin = Admin(app, name='ContentDB', template_mode='bootstrap3', url="/admin/db")
|
admin = Admin(app, name='ContentDB', template_mode='bootstrap3', url="/admin/db")
|
||||||
admin.add_view(MyModelView(User, db.session))
|
admin.add_view(MyModelView(User, db.session))
|
||||||
|
@ -51,9 +51,9 @@ def github_authorized(oauth_token):
|
|||||||
if current_user and current_user.is_authenticated:
|
if current_user and current_user.is_authenticated:
|
||||||
if userByGithub is None:
|
if userByGithub is None:
|
||||||
current_user.github_username = username
|
current_user.github_username = username
|
||||||
db.session.add(auth)
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return redirect(url_for("gitAccount", id=auth.id))
|
flash("Linked github to account", "success")
|
||||||
|
return redirect(url_for("home_page"))
|
||||||
else:
|
else:
|
||||||
flash("Github account is already associated with another user", "danger")
|
flash("Github account is already associated with another user", "danger")
|
||||||
return redirect(url_for("home_page"))
|
return redirect(url_for("home_page"))
|
||||||
|
Loading…
Reference in New Issue
Block a user