fix: Show error message when signing in to suspended account
closes #1056
This commit is contained in:
@ -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);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ function Home(props: Props) {
|
|||||||
</Helmet>
|
</Helmet>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Hero id="signin">
|
<Hero id="signin">
|
||||||
|
<AuthErrors notice={props.notice} />
|
||||||
<h1>Your team’s knowledge base</h1>
|
<h1>Your team’s 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>
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user