fix: Show error message when signing in to suspended account

closes #1056
This commit is contained in:
Tom Moor
2019-10-12 19:16:17 -07:00
parent fc201663c6
commit ec4d4fb20f
4 changed files with 13 additions and 3 deletions

View File

@ -81,7 +81,11 @@ export default function auth(options?: { required?: boolean } = {}) {
ctx.cache[user.id] = user; 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 // update the database when the user last signed in
user.updateSignedIn(ctx.request.ip); user.updateSignedIn(ctx.request.ip);

View File

@ -29,6 +29,7 @@ function Home(props: Props) {
</Helmet> </Helmet>
<Grid> <Grid>
<Hero id="signin"> <Hero id="signin">
<AuthErrors notice={props.notice} />
<h1>Your teams knowledge base</h1> <h1>Your teams knowledge base</h1>
<HeroText> <HeroText>
Team wiki, documentation, meeting notes, playbooks, onboarding, work Team wiki, documentation, meeting notes, playbooks, onboarding, work
@ -37,7 +38,6 @@ function Home(props: Props) {
<p> <p>
<SigninButtons {...props} /> <SigninButtons {...props} />
</p> </p>
<AuthErrors notice={props.notice} />
</Hero> </Hero>
<Mask> <Mask>
<Features> <Features>

View File

@ -39,6 +39,7 @@ function SubdomainSignin({
<PageTitle title={`Sign in to ${team.name}`} /> <PageTitle title={`Sign in to ${team.name}`} />
<Grid> <Grid>
<Hero> <Hero>
<AuthErrors notice={notice} />
<h1>{lastSignedIn ? 'Welcome back,' : 'Hey there,'}</h1> <h1>{lastSignedIn ? 'Welcome back,' : 'Hey there,'}</h1>
<HeroText> <HeroText>
Sign in with your team account to continue to {team.name}. Sign in with your team account to continue to {team.name}.
@ -51,7 +52,6 @@ function SubdomainSignin({
lastSignedIn={signinHint} lastSignedIn={signinHint}
/> />
</p> </p>
<AuthErrors notice={notice} />
</Hero> </Hero>
</Grid> </Grid>
<Alternative> <Alternative>

View File

@ -27,6 +27,12 @@ export default function AuthErrors({ notice }: Props) {
Please try again. Please try again.
</Notice> </Notice>
)} )}
{notice === 'suspended' && (
<Notice>
Your Outline account has been suspended. To re-activate your account,
please contact a team admin.
</Notice>
)}
</React.Fragment> </React.Fragment>
); );
} }