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.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);
|
||||
|
||||
|
@ -29,6 +29,7 @@ function Home(props: Props) {
|
||||
</Helmet>
|
||||
<Grid>
|
||||
<Hero id="signin">
|
||||
<AuthErrors notice={props.notice} />
|
||||
<h1>Your team’s knowledge base</h1>
|
||||
<HeroText>
|
||||
Team wiki, documentation, meeting notes, playbooks, onboarding, work
|
||||
@ -37,7 +38,6 @@ function Home(props: Props) {
|
||||
<p>
|
||||
<SigninButtons {...props} />
|
||||
</p>
|
||||
<AuthErrors notice={props.notice} />
|
||||
</Hero>
|
||||
<Mask>
|
||||
<Features>
|
||||
|
@ -39,6 +39,7 @@ function SubdomainSignin({
|
||||
<PageTitle title={`Sign in to ${team.name}`} />
|
||||
<Grid>
|
||||
<Hero>
|
||||
<AuthErrors notice={notice} />
|
||||
<h1>{lastSignedIn ? 'Welcome back,' : 'Hey there,'}</h1>
|
||||
<HeroText>
|
||||
Sign in with your team account to continue to {team.name}.
|
||||
@ -51,7 +52,6 @@ function SubdomainSignin({
|
||||
lastSignedIn={signinHint}
|
||||
/>
|
||||
</p>
|
||||
<AuthErrors notice={notice} />
|
||||
</Hero>
|
||||
</Grid>
|
||||
<Alternative>
|
||||
|
@ -27,6 +27,12 @@ export default function AuthErrors({ notice }: Props) {
|
||||
Please try again.
|
||||
</Notice>
|
||||
)}
|
||||
{notice === 'suspended' && (
|
||||
<Notice>
|
||||
Your Outline account has been suspended. To re-activate your account,
|
||||
please contact a team admin.
|
||||
</Notice>
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user