1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Permetti di disabilitare il login con osu

This commit is contained in:
Steffo 2020-07-23 01:27:46 +02:00
parent c41ae6b116
commit 4f5199c88f

View file

@ -91,9 +91,12 @@ class ApiAuthLoginOsuStar(rca.ApiStar):
raise rcae.ForbiddenError("Unknown osu! account") raise rcae.ForbiddenError("Unknown osu! account")
user = osu.user user = osu.user
if self.config["osu"]["login"]["enabled"]:
token: rbt.Token = TokenT.generate(alchemy=self.alchemy, user=user, expiration_delta=datetime.timedelta(days=7)) token: rbt.Token = TokenT.generate(alchemy=self.alchemy, user=user, expiration_delta=datetime.timedelta(days=7))
data.session.add(token) data.session.add(token)
await data.session_commit() await data.session_commit()
return token.json() return token.json()
else:
raise rcae.ForbiddenError("Account linked successfully; cannot use this account to generate a Royalnet"
" login token, as osu! login is currently disabled on this Royalnet instance.")