diff --git a/nyaa/views/account.py b/nyaa/views/account.py index 4727198..2736147 100644 --- a/nyaa/views/account.py +++ b/nyaa/views/account.py @@ -37,9 +37,17 @@ def login(): 'Login failed! Incorrect username or password.'), 'danger') return flask.redirect(flask.url_for('account.login')) + if user.is_banned: + ban_reason = models.Ban.banned(user.id, None).first().reason + ban_str = ('Login failed! You are banned with the ' + 'reason "{0}" If you believe that this is a mistake, contact ' + 'a moderator on IRC.'.format(ban_reason)) + flask.flash(flask.Markup(ban_str), 'danger') + return flask.redirect(flask.url_for('account.login')) + if user.status != models.UserStatusType.ACTIVE: flask.flash(flask.Markup( - 'Login failed! Account is not activated or banned.'), 'danger') + 'Login failed! Account is not activated.'), 'danger') return flask.redirect(flask.url_for('account.login')) user.last_login_date = datetime.utcnow()