This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/server/pages/components/SigninButtons.js
Tom Moor 6d8216c54e feat: Guest email authentication (#1088)
* feat: API endpoints for email signin

* fix: After testing

* Initial signin flow working

* move shared middleware

* feat: Add guest signin toggle, obey on endpoints

* feat: Basic email signin when enabled

* Improve guest signin email
Disable double signin with JWT

* fix: Simple rate limiting

* create placeholder users in db

* fix: Give invited users default avatar
add invited users to people settings

* test

* add transaction

* tmp: test CI

* derp

* md5

* urgh

* again

* test: pass

* test

* fix: Remove usage of data values

* guest signin page

* Visually separator 'Invited' from other people tabs

* fix: Edge case attempting SSO signin for guest email account

* fix: Correctly set email auth method to cookie

* Improve rate limit error display

* lint: cleanup / comments

* Improve invalid token error display

* style tweaks

* pass guest value to subdomain

* Restore copy link option

* feat: Allow invite revoke from people management

* fix: Incorrect users email schema does not allow for user deletion

* lint

* fix: avatarUrl for deleted user failure

* change default to off for guest invites

* fix: Changing security settings wipes subdomain

* fix: user delete permissioning

* test: Add user.invite specs
2019-12-15 18:46:08 -08:00

95 lines
2.2 KiB
JavaScript

// @flow
import * as React from 'react';
import styled from 'styled-components';
import Button from './Button';
import { signin } from '../../../shared/utils/routeHelpers';
import Flex from '../../../shared/components/Flex';
import Notice from '../../../shared/components/Notice';
import GoogleLogo from '../../../shared/components/GoogleLogo';
import SlackLogo from '../../../shared/components/SlackLogo';
import breakpoint from 'styled-components-breakpoint';
type Props = {
lastSignedIn?: string,
googleSigninEnabled: boolean,
slackSigninEnabled: boolean,
guestSigninEnabled?: boolean,
};
const SigninButtons = ({
lastSignedIn,
slackSigninEnabled,
googleSigninEnabled,
guestSigninEnabled,
}: Props) => {
return (
<Wrapper>
{!slackSigninEnabled &&
!googleSigninEnabled && (
<Notice>
Neither Slack or Google sign in is enabled. You must configure at
least one authentication method to sign in to Outline.
</Notice>
)}
{slackSigninEnabled && (
<Column column>
<Button href={signin('slack')}>
<SlackLogo />
<Spacer>Sign In with Slack</Spacer>
</Button>
<LastLogin>
{lastSignedIn === 'slack' && 'You signed in with Slack previously'}
</LastLogin>
</Column>
)}
{googleSigninEnabled && (
<Column column>
<Button href={signin('google')}>
<GoogleLogo />
<Spacer>Sign In with Google</Spacer>
</Button>
<LastLogin>
{lastSignedIn === 'google' &&
'You signed in with Google previously'}
</LastLogin>
</Column>
)}
</Wrapper>
);
};
const Column = styled(Flex)`
text-align: center;
${breakpoint('tablet')`
&:first-child {
margin-right: 8px;
}
`};
`;
const Wrapper = styled(Flex)`
display: block;
justify-content: center;
margin-top: 16px;
${breakpoint('tablet')`
display: flex;
justify-content: flex-start;
margin-top: 0;
`};
`;
const Spacer = styled.span`
padding-left: 10px;
`;
const LastLogin = styled.p`
font-size: 13px;
font-weight: 500;
color: rgba(20, 23, 26, 0.5);
padding-top: 4px;
`;
export default SigninButtons;