From ec4d4fb20f475bc3900f29165a8ee8a2ba57899d Mon Sep 17 00:00:00 2001
From: Tom Moor
Date: Sat, 12 Oct 2019 19:16:17 -0700
Subject: [PATCH] fix: Show error message when signing in to suspended account
closes #1056
---
server/middlewares/authentication.js | 6 +++++-
server/pages/Home.js | 2 +-
server/pages/SubdomainSignin.js | 2 +-
server/pages/components/AuthErrors.js | 6 ++++++
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/server/middlewares/authentication.js b/server/middlewares/authentication.js
index 16c9adc7..3fcf9b36 100644
--- a/server/middlewares/authentication.js
+++ b/server/middlewares/authentication.js
@@ -81,7 +81,11 @@ export default function auth(options?: { required?: boolean } = {}) {
ctx.cache[user.id] = user;
}
- ctx.signIn = (user, team, service, isFirstSignin = false) => {
+ ctx.signIn = async (user, team, service, isFirstSignin = false) => {
+ if (user.isSuspended) {
+ return ctx.redirect('/?notice=suspended');
+ }
+
// update the database when the user last signed in
user.updateSignedIn(ctx.request.ip);
diff --git a/server/pages/Home.js b/server/pages/Home.js
index 654b3cb7..cef2f436 100644
--- a/server/pages/Home.js
+++ b/server/pages/Home.js
@@ -29,6 +29,7 @@ function Home(props: Props) {
+
Your team’s knowledge base
Team wiki, documentation, meeting notes, playbooks, onboarding, work
@@ -37,7 +38,6 @@ function Home(props: Props) {
-
diff --git a/server/pages/SubdomainSignin.js b/server/pages/SubdomainSignin.js
index 987a0a8f..8c28df12 100644
--- a/server/pages/SubdomainSignin.js
+++ b/server/pages/SubdomainSignin.js
@@ -39,6 +39,7 @@ function SubdomainSignin({
+
{lastSignedIn ? 'Welcome back,' : 'Hey there,'}
Sign in with your team account to continue to {team.name}.
@@ -51,7 +52,6 @@ function SubdomainSignin({
lastSignedIn={signinHint}
/>
-
diff --git a/server/pages/components/AuthErrors.js b/server/pages/components/AuthErrors.js
index 6a6cf80c..bf42b2e0 100644
--- a/server/pages/components/AuthErrors.js
+++ b/server/pages/components/AuthErrors.js
@@ -27,6 +27,12 @@ export default function AuthErrors({ notice }: Props) {
Please try again.
)}
+ {notice === 'suspended' && (
+
+ Your Outline account has been suspended. To re-activate your account,
+ please contact a team admin.
+
+ )}
);
}