Skip to content

Commit d64d75b

Browse files
authored
feat(condo): DOMA-9722 new auth flow (frontend) (#5860)
* fix(condo): DOMA-9722 fixed typography color fix(condo): DOMA-9722 fixed border-radius fix(condo): DOMA-9722 fixed styles for FormItem chore(ui): DOMA-9722 deprecated PhoneInput fix(ui): DOMA-9722 added CookieAgreement to /auth page chore(ui): DOMA-9722 updated schema fix(ui): DOMA-9722 fixed styles for Input.Phone fix(condo): DOMA-9722 fixed error mapping fix(condo): DOMA-9722 removed password creating when invite new organization employee refactor(condo): DOMA-9722 refactored regex fix(condo): DOMA-9722 fixed link in messages feat(condo): DOMA-9722 added link to telegram bot feat(condo): DOMA-9722 added links for resident app fix(condo): DOMA-9722 fixed after review fix(condo): DOMA-9722 fixed after review by sonar fix(condo): DOMA-9722 updated condition fix(condo): DOMA-9722 fixed styles feat(condo): DOMA-9722 updated schema feat(condo): DOMA-9722 removed sms after user registration feat(condo): DOMA-9722 added redirects if no resident app. Fixed styles feat(condo): DOMA-9722 added images and translations feat(condo): DOMA-9722 updated layout with poster feat(condo): DOMA-9722 added translation feat(condo): DOMA-9722 added display of QR code. Refactored styles fix(condo): DOMA-9722 fixed redirects to auth feat(condo): DOMA-9722 remove credentials from messages feat(condo): DOMA-9722 added redirects for auth pages chore(condo): DOMA-9722 removed unused code fix(condo): DOMA-9722 fixed imports feat(condo): DOMA-9722 new auth pages feat(condo): DOMA-9722 show errors in form via useMutationErrorHandler chore(condo): DOMA-9722 removed todo feat(condo): DOMA-9722 added errorMapping to AuthenticateOrRegisterUserWithTokenService feat(condo): DOMA-9722 fixed error mapping for keystone errors (for backward compatibility) feat(condo): DOMA-9722 add size for Space refactor(condo): DOMA-9722 added types fix(condo): DOMA-9722 fixed captcha when it disabled * fix(condo): DOMA-9722 fixed after rebase * refactor(condo): DOMA-9722 removed global styles * fix(condo): DOMA-9722 fixed styles * fix(condo): DOMA-9722 prevented infinite redirection * feat(condo): DOMA-9722 added tab indexes * feat(condo): DOMA-9722 updated pages * feat(condo): DOMA-9722 added hint for password * feat(ui): DOMA-9722 added tabIndex for checkbox * feat(condo): DOMA-9722 fixed error messages * fix(condo): DOMA-9722 fixed conditions * fix(condo): DOMA-9722 fixed translations * feat(condo): DOMA-9722 added button for back to main page from password reset page * fix(condo): DOMA-9722 fixed gutter * fix(condo): DOMA-9722 fixed conditions * feat(condo): DOMA-9722 added a phone formatting * fix(condo): DOMA-9722 fixed formatPhone * refactor(condo): DOMA-9722 some refactoring * feat(condo): DOMA-9722 removed unused translations * feat(condo): DOMA-9722 updated callcenter * feat(condo): DOMA-9722 updated UserProfileForm * refactor(condo): DOMA-9722 refactored UserProfileForm * fix(condo): DOMA-9722 fixed gutters * refactor(condo): DOMA-9722 removed old component from UserProfileForm * feat(condo): DOMA-9722 updated mailing agreement * fix(condo): DOMA-9722 fixed layout width * fix(condo): DOMA-9722 fixed message when invite employee to holding * fix(condo): DOMA-9722 removed prop to show password reset button in profile page * feat(condo): DOMA-9722 updated message for TOO_MANY_REQUESTS error * fix(condo): DOMA-9722 fixed page reload * fix(condo): DOMA-9722 fixed tests * feat(condo): DOMA-9722 updated header * feat(condo): DOMA-9722 updated layouts * feat(condo): DOMA-9722 updated helm and callcenter to main * feat(condo): DOMA-9722 changed order of tabs * fix(condo): DOMA-9722 fixed tests * fix(condo): DOMA-9722 fixed tests
1 parent 106f4d6 commit d64d75b

File tree

111 files changed

+3080
-2017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3080
-2017
lines changed

.helm

Submodule .helm updated from 1fef982 to 980a2f8

apps/callcenter

apps/condo/domains/billing/schema/ValidateQRCodeService.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ describe('ValidateQRCodeService', () => {
391391
{
392392
code: 'BAD_USER_INPUT',
393393
type: 'TOO_MANY_REQUESTS',
394-
message: 'You have to wait {secondsRemaining} seconds to be able to send request again',
394+
message: 'You have to wait {minutesRemaining} min. to be able to send request again',
395395
},
396396
'result',
397397
)

apps/condo/domains/common/components/Form/FormItem.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ export const FormItem = styled(Form.Item)`
1111
white-space: nowrap;
1212
}
1313
}
14+
15+
.ant-form-item-control {
16+
gap: 4px 0;
17+
}
1418
`

apps/condo/domains/common/components/HCaptcha.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import React, { createContext, FC, useCallback, useContext, useMemo, useRef } fr
77
import { useIntl } from '@open-condo/next/intl'
88
import { Button } from '@open-condo/ui'
99

10+
import { makeId } from '@condo/domains/common/utils/makeid.utils'
11+
1012

1113
type IHCaptchaContext = {
1214
executeCaptcha: () => Promise<string>
@@ -30,7 +32,7 @@ const HCaptchaProvider: FC = ({ children }) => {
3032

3133
const executeCaptcha: IHCaptchaContext['executeCaptcha'] = useCallback(async () => {
3234
// NOTE: We cannot not send anything when the captcha is turned off, since the captcha field is required
33-
if (!hCaptchaConfig || !siteKey || disableCaptcha) return 'condo-captcha-disabled'
35+
if (!hCaptchaConfig || !siteKey || disableCaptcha) return makeId(48)
3436
if (!ref.current) return
3537

3638
ref.current.resetCaptcha()
Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
1-
import { Tabs } from 'antd'
21
import { useRouter } from 'next/router'
3-
import React from 'react'
2+
import React, { useCallback, useMemo } from 'react'
43

54
import { useIntl } from '@open-condo/next/intl'
5+
import { Tabs } from '@open-condo/ui'
66

77
import { isSafeUrl } from '@condo/domains/common/utils/url.utils'
8-
import { RemoveTabsLineWrapper } from '@condo/domains/user/components/containers/styles'
98

10-
interface ITabsActionsProps {
9+
10+
type TabsAuthActionsProps = {
1111
currentActiveKey: string
1212
}
1313

14-
export const TabsAuthAction: React.FC<ITabsActionsProps> = (props) => {
14+
export const TabsAuthAction: React.FC<TabsAuthActionsProps> = (props) => {
1515
const { currentActiveKey } = props
1616
const intl = useIntl()
17-
const registerTab = intl.formatMessage({ id: 'pages.auth.RegistrationTitle' })
18-
const signInTab = intl.formatMessage({ id: 'pages.auth.SignInTitle' })
17+
const registerTab = intl.formatMessage({ id: 'pages.auth.register.step.inputPhone.title' })
18+
const signInTab = intl.formatMessage({ id: 'pages.auth.signin.title' })
1919

2020
const router = useRouter()
2121
const { query: { next } } = router
2222
const isValidNextUrl = next && !Array.isArray(next) && isSafeUrl(next)
2323

24+
const handleChange = useCallback((activeKey: string): void => {
25+
if (activeKey === 'signin') {
26+
router.push(isValidNextUrl ? `/auth/signin?next=${encodeURIComponent(next)}` : '/auth/signin')
27+
} else if (activeKey === 'register') {
28+
router.push(isValidNextUrl ? `/auth/register?next=${encodeURIComponent(next)}` : '/auth/register')
29+
}
30+
}, [isValidNextUrl, next])
31+
32+
const tabItems = useMemo(() => [
33+
{ key: 'signin', label: signInTab },
34+
{ key: 'register', label: registerTab },
35+
], [registerTab, signInTab])
36+
2437
return (
25-
<RemoveTabsLineWrapper>
26-
<Tabs
27-
defaultActiveKey={currentActiveKey}
28-
onChange={(activeKey) => {
29-
if (activeKey === 'signin') {
30-
router.push(isValidNextUrl ? `/auth/signin?next=${encodeURIComponent(next)}` : '/auth/signin')
31-
} else if (activeKey === 'register') {
32-
router.push(isValidNextUrl ? `/auth/register?step=inputPhone&next=${encodeURIComponent(next)}` : '/auth/register')
33-
}}}
34-
centered
35-
animated={false}
36-
>
37-
<Tabs.TabPane key='register' tab={registerTab}/>
38-
<Tabs.TabPane key='signin' tab={signInTab}/>
39-
</Tabs>
40-
</RemoveTabsLineWrapper>
38+
<Tabs
39+
items={tabItems}
40+
defaultActiveKey={currentActiveKey}
41+
onChange={handleChange}
42+
/>
4143
)
4244
}

apps/condo/domains/common/components/LoginWithSBBOLButton.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ import { useIntl } from '@open-condo/next/intl'
66
import { Button } from '@open-condo/ui'
77
import { colors } from '@open-condo/ui/dist/colors'
88

9-
import { useCheckTLSClientCert } from '../hooks/useCheckTLSClientCert'
9+
import { useCheckTLSClientCert } from '@condo/domains/common/hooks/useCheckTLSClientCert'
1010

11-
export const LoginWithSBBOLButton: React.FC<{ label?: string, block?: boolean, redirect?: string, checkTlsCert: boolean }> = ({
11+
12+
type LoginWithSBBOLButtonProps = {
13+
label?: string
14+
block?: boolean
15+
redirect?: string
16+
checkTlsCert: boolean
17+
tabIndex?: number
18+
}
19+
20+
export const LoginWithSBBOLButton: React.FC<LoginWithSBBOLButtonProps> = ({
1221
label,
1322
block,
1423
redirect,
1524
checkTlsCert = true,
25+
tabIndex,
1626
}) => {
1727
const intl = useIntl()
1828
const LoginLabel = intl.formatMessage({ id: 'LoginBySBBOL' })
@@ -42,6 +52,8 @@ export const LoginWithSBBOLButton: React.FC<{ label?: string, block?: boolean, r
4252
onClick={() => checkTlsCert ? checkSSLClientCert() : redirectToAuth()}
4353
loading={loading}
4454
block={block}
55+
id='loginWithSBBOL'
56+
tabIndex={tabIndex}
4557
>
4658
{label || LoginLabel}
4759
</Button>

apps/condo/domains/common/components/PhoneInput.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ const getPhoneInputStyles = (style, size: SizeType, block?: boolean) => {
6565

6666
const BUTTON_INPUT_PHONE_STYLE: React.CSSProperties = { margin: 5, backgroundColor: colors.backgroundWhiteSecondary, border: 0, borderRadius: 8 }
6767

68+
/**
69+
* @deprecated use Input.Phone from Condo UI Kit
70+
*/
6871
export const PhoneInput: React.FC<IPhoneInputProps> = forwardRef((props, ref) => {
6972
const { value, placeholder, style, disabled, block, showCountryPrefix = true, country, ...otherProps } = props
7073
const configSize = useContext<SizeType>(ConfigProvider.SizeContext)

apps/condo/domains/common/components/containers/BaseLayout/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const Header: React.FC<IHeaderProps> = (props) => {
6666
if (isAuthenticated) {
6767
router.push('/')
6868
} else {
69-
router.push('/auth/signin')
69+
router.push('/auth')
7070
}
7171
}, [isAuthenticated, router])
7272

apps/condo/domains/common/components/containers/BaseLayout/components/styles.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,10 @@ import { Layout } from 'antd'
44

55
import { colors, MAX_CONTENT_WIDTH } from '@condo/domains/common/constants/style'
66

7-
const { red } = require('@ant-design/colors')
87

98
export const SIDE_MENU_WIDTH = 256
109
export const COLLAPSED_SIDE_MENU_WIDTH = 92
1110

12-
// Ant inputs
13-
export const FROM_INPUT_CSS = css`
14-
body {
15-
height: 100%
16-
}
17-
18-
.ant-input-affix-wrapper:focus,
19-
.ant-input-affix-wrapper-focused,
20-
.ant-form-item-has-error .ant-input-affix-wrapper:focus,
21-
.ant-form-item-has-error .ant-input-affix-wrapper-focused {
22-
background-color: ${colors.white};
23-
}
24-
25-
.ant-input-affix-wrapper > input.ant-input,
26-
.ant-form-item-has-error .ant-input-affix-wrapper > input.ant-input {
27-
-webkit-box-shadow: inset 0 0 0 50px ${colors.ultraLightGrey};
28-
-webkit-text-fill-color: ${colors.black};
29-
}
30-
31-
.ant-form-item-has-error .ant-input-affix-wrapper > input.ant-input:focus,
32-
.ant-input-affix-wrapper > input.ant-input:focus {
33-
-webkit-box-shadow: inset 0 0 0 50px ${colors.white};
34-
-webkit-text-fill-color: ${colors.black};
35-
background-color: ${colors.white};
36-
}
37-
38-
.ant-form-item-has-error .ant-input-affix-wrapper:not(.ant-input-affix-wrapper-disabled):hover {
39-
border-color: ${red[5]};
40-
}
41-
42-
.ant-form-item-has-error .ant-input-affix-wrapper-focused:hover,
43-
.ant-form-item-has-error .ant-input-affix-wrapper:focus:hover {
44-
border-color: ${red[5]};
45-
background-color: ${colors.white};
46-
}
47-
48-
.ant-input:focus:hover, .ant-input:active:hover {
49-
background-color: ${colors.white};
50-
}
51-
`
52-
5311
export const MobileSideNavHeader = styled.div`
5412
display: flex;
5513
flex-direction: row;

0 commit comments

Comments
 (0)