mirror of
https://github.com/hcengineering/platform.git
synced 2025-03-19 21:31:30 +00:00
Fix wrong merge
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
f9c3dd38d2
commit
bcbc8af9e5
@ -31,7 +31,6 @@
|
|||||||
on:change
|
on:change
|
||||||
on:keyup
|
on:keyup
|
||||||
on:input
|
on:input
|
||||||
maxlength={1}
|
|
||||||
inputmode="numeric"
|
inputmode="numeric"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
setMetadataLocalStorage(login.metadata.LastToken, result.token)
|
setMetadataLocalStorage(login.metadata.LastToken, result.token)
|
||||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||||
await afterConfirm('onboard')
|
await afterConfirm()
|
||||||
} else {
|
} else {
|
||||||
goTo('login')
|
goTo('login')
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
import loginBackWebp from '../../img/login_back.webp'
|
import loginBackWebp from '../../img/login_back.webp'
|
||||||
import loginBack2xWebp from '../../img/login_back_2x.webp'
|
import loginBack2xWebp from '../../img/login_back_2x.webp'
|
||||||
import login from '../plugin'
|
import login from '../plugin'
|
||||||
import OnboardForm from './OnboardForm.svelte'
|
|
||||||
|
|
||||||
export let page: Pages = 'signup'
|
export let page: Pages = 'signup'
|
||||||
|
|
||||||
@ -138,8 +137,6 @@
|
|||||||
<LoginForm {navigateUrl} />
|
<LoginForm {navigateUrl} />
|
||||||
{:else if page === 'signup'}
|
{:else if page === 'signup'}
|
||||||
<SignupForm />
|
<SignupForm />
|
||||||
{:else if page === 'onboard'}
|
|
||||||
<OnboardForm />
|
|
||||||
{:else if page === 'createWorkspace'}
|
{:else if page === 'createWorkspace'}
|
||||||
<CreateWorkspaceForm />
|
<CreateWorkspaceForm />
|
||||||
{:else if page === 'password'}
|
{:else if page === 'password'}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { LoginInfo, WorkspaceLoginInfo } from '@hcengineering/login'
|
import login, { LoginInfo, WorkspaceLoginInfo } from '@hcengineering/login'
|
||||||
import { OK } from '@hcengineering/platform'
|
import { OK } from '@hcengineering/platform'
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
|
|
||||||
|
@ -81,9 +81,14 @@
|
|||||||
|
|
||||||
if (value == null || value === '') return
|
if (value == null || value === '') return
|
||||||
|
|
||||||
|
if (value.length === fields.length) {
|
||||||
|
pasteOtpCode(value)
|
||||||
|
} else {
|
||||||
const index = fields.findIndex(({ id }) => id === target.id)
|
const index = fields.findIndex(({ id }) => id === target.id)
|
||||||
if (index === -1) return
|
if (index === -1) return
|
||||||
|
|
||||||
|
target.value = value[0]
|
||||||
|
|
||||||
if (Object.values(otpData).every((v) => v !== '')) {
|
if (Object.values(otpData).every((v) => v !== '')) {
|
||||||
void validateOtp()
|
void validateOtp()
|
||||||
return
|
return
|
||||||
@ -97,6 +102,7 @@
|
|||||||
nextInput.focus()
|
nextInput.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function clearOtpData (): void {
|
function clearOtpData (): void {
|
||||||
Object.keys(otpData).forEach((key) => {
|
Object.keys(otpData).forEach((key) => {
|
||||||
@ -139,9 +145,15 @@
|
|||||||
if (e.clipboardData == null) return
|
if (e.clipboardData == null) return
|
||||||
|
|
||||||
const text = e.clipboardData.getData('text')
|
const text = e.clipboardData.getData('text')
|
||||||
|
pasteOtpCode(text)
|
||||||
|
}
|
||||||
|
|
||||||
|
function pasteOtpCode (text: string): boolean {
|
||||||
const digits = text.split('').filter((it) => it !== ' ')
|
const digits = text.split('').filter((it) => it !== ' ')
|
||||||
|
|
||||||
if (digits.length !== fields.length) return
|
if (digits.length !== fields.length) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let focusName: string | undefined = undefined
|
let focusName: string | undefined = undefined
|
||||||
|
|
||||||
@ -160,6 +172,8 @@
|
|||||||
if (Object.values(otpData).every((v) => v !== '')) {
|
if (Object.values(otpData).every((v) => v !== '')) {
|
||||||
void validateOtp()
|
void validateOtp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (formElement != null) {
|
$: if (formElement != null) {
|
||||||
|
@ -62,16 +62,9 @@ export const pages = [
|
|||||||
'confirm',
|
'confirm',
|
||||||
'confirmationSend',
|
'confirmationSend',
|
||||||
'auth',
|
'auth',
|
||||||
'login-password',
|
'login-password'
|
||||||
'onboard'
|
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export enum OnboardSteps {
|
|
||||||
Workspace = 'workspace',
|
|
||||||
User = 'user',
|
|
||||||
Finish = 'finish'
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum OtpLoginSteps {
|
export enum OtpLoginSteps {
|
||||||
Email = 'email',
|
Email = 'email',
|
||||||
Otp = 'otp'
|
Otp = 'otp'
|
||||||
|
@ -67,12 +67,6 @@ export default mergeIds(loginId, login, {
|
|||||||
SentTo: '' as IntlString,
|
SentTo: '' as IntlString,
|
||||||
CanFindCode: '' as IntlString,
|
CanFindCode: '' as IntlString,
|
||||||
LoginWithCode: '' as IntlString,
|
LoginWithCode: '' as IntlString,
|
||||||
LoginWithPassword: '' as IntlString,
|
LoginWithPassword: '' as IntlString
|
||||||
FillInProfile: '' as IntlString,
|
|
||||||
SetUpPassword: '' as IntlString,
|
|
||||||
Next: '' as IntlString,
|
|
||||||
Skip: '' as IntlString,
|
|
||||||
SignUpCompleted: '' as IntlString,
|
|
||||||
StartUsingHuly: '' as IntlString
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -521,7 +521,7 @@ export async function getInviteLinkId (
|
|||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const accountsUrl = getMetadata(login.metadata.AccountsUrl)
|
const accountsUrl = getMetadata(login.metadata.AccountsUrl)
|
||||||
|
|
||||||
const exp = expHours * 1000 * 60 * 60
|
const exp = expHours < 0 ? -1 : expHours * 1000 * 60 * 60
|
||||||
|
|
||||||
if (accountsUrl === undefined) {
|
if (accountsUrl === undefined) {
|
||||||
throw new Error('accounts url not specified')
|
throw new Error('accounts url not specified')
|
||||||
@ -872,10 +872,10 @@ export function getHref (path: Pages): string {
|
|||||||
return host + url
|
return host + url
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function afterConfirm (wspage: 'onboard' | 'createWorkspace' = 'createWorkspace'): Promise<void> {
|
export async function afterConfirm (): Promise<void> {
|
||||||
const joinedWS = await getWorkspaces()
|
const joinedWS = await getWorkspaces()
|
||||||
if (joinedWS.length === 0) {
|
if (joinedWS.length === 0) {
|
||||||
goTo(wspage)
|
goTo('createWorkspace')
|
||||||
} else if (joinedWS.length === 1) {
|
} else if (joinedWS.length === 1) {
|
||||||
const result = (await selectWorkspace(joinedWS[0].workspace, null))[1]
|
const result = (await selectWorkspace(joinedWS[0].workspace, null))[1]
|
||||||
if (result !== undefined) {
|
if (result !== undefined) {
|
||||||
@ -1044,12 +1044,3 @@ export async function doLoginNavigate (
|
|||||||
navigate(loc)
|
navigate(loc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ensureConfirmed (account: LoginInfo): Promise<void> {
|
|
||||||
if (!account.confirmed) {
|
|
||||||
const loc = getCurrentLocation()
|
|
||||||
loc.path[1] = 'confirmationSend'
|
|
||||||
loc.path.length = 2
|
|
||||||
navigate(loc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -55,7 +55,7 @@ export function registerToken (
|
|||||||
|
|
||||||
measureCtx.info('Success auth, redirect', { email: user.email, type: 'token' })
|
measureCtx.info('Success auth, redirect', { email: user.email, type: 'token' })
|
||||||
// Successful authentication, redirect to your application
|
// Successful authentication, redirect to your application
|
||||||
ctx.redirect(concatLink(branding?.front ?? frontUrl, '/login/auth'))
|
ctx.redirect(concatLink(branding?.front ?? frontUrl, '/onboard/auth'))
|
||||||
}
|
}
|
||||||
await next()
|
await next()
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,6 @@ async function hideOldActivityChannels (
|
|||||||
const { lastUpdateTimestamp = 0, lastViewedTimestamp = 0 } = context
|
const { lastUpdateTimestamp = 0, lastViewedTimestamp = 0 } = context
|
||||||
|
|
||||||
if (lastUpdateTimestamp > lastViewedTimestamp) continue
|
if (lastUpdateTimestamp > lastViewedTimestamp) continue
|
||||||
console.log({ diff: date - lastUpdateTimestamp, delay: hideChannelDelay })
|
|
||||||
if (date - lastUpdateTimestamp < hideChannelDelay) continue
|
if (date - lastUpdateTimestamp < hideChannelDelay) continue
|
||||||
|
|
||||||
const params = hierarchy.as(context, chunter.mixin.ChannelInfo)
|
const params = hierarchy.as(context, chunter.mixin.ChannelInfo)
|
||||||
|
@ -9,9 +9,8 @@ import account, {
|
|||||||
accountId,
|
accountId,
|
||||||
cleanExpiredOtp,
|
cleanExpiredOtp,
|
||||||
cleanInProgressWorkspaces,
|
cleanInProgressWorkspaces,
|
||||||
getMethods,
|
getAllTransactors,
|
||||||
cleanExpiredOtp,
|
getMethods
|
||||||
getAllTransactors
|
|
||||||
} from '@hcengineering/account'
|
} from '@hcengineering/account'
|
||||||
import accountEn from '@hcengineering/account/lang/en.json'
|
import accountEn from '@hcengineering/account/lang/en.json'
|
||||||
import accountRu from '@hcengineering/account/lang/ru.json'
|
import accountRu from '@hcengineering/account/lang/ru.json'
|
||||||
@ -113,8 +112,6 @@ export function serveAccount (
|
|||||||
|
|
||||||
let worker: UpgradeWorker | undefined
|
let worker: UpgradeWorker | undefined
|
||||||
|
|
||||||
let worker: UpgradeWorker | undefined
|
|
||||||
|
|
||||||
const app = new Koa()
|
const app = new Koa()
|
||||||
const router = new Router()
|
const router = new Router()
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import contact, {
|
|||||||
Person,
|
Person,
|
||||||
PersonAccount
|
PersonAccount
|
||||||
} from '@hcengineering/contact'
|
} from '@hcengineering/contact'
|
||||||
import { buildStorageFromConfig, storageConfigFromEnv } from '@hcengineering/server-storage'
|
|
||||||
import core, {
|
import core, {
|
||||||
AccountRole,
|
AccountRole,
|
||||||
BaseWorkspaceInfo,
|
BaseWorkspaceInfo,
|
||||||
@ -40,30 +39,17 @@ import core, {
|
|||||||
Ref,
|
Ref,
|
||||||
roleOrder,
|
roleOrder,
|
||||||
systemAccountEmail,
|
systemAccountEmail,
|
||||||
|
Timestamp,
|
||||||
Tx,
|
Tx,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
Version,
|
Version,
|
||||||
versionToString,
|
versionToString,
|
||||||
WorkspaceId,
|
WorkspaceId,
|
||||||
Timestamp,
|
|
||||||
WorkspaceIdWithUrl,
|
WorkspaceIdWithUrl,
|
||||||
type Branding
|
type Branding
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { consoleModelLogger, MigrateOperation, ModelLogger } from '@hcengineering/model'
|
import { consoleModelLogger, MigrateOperation, ModelLogger } from '@hcengineering/model'
|
||||||
import platform, { getMetadata, PlatformError, Severity, Status, translate } from '@hcengineering/platform'
|
import platform, { getMetadata, PlatformError, Severity, Status, translate } from '@hcengineering/platform'
|
||||||
import { decodeToken, generateToken } from '@hcengineering/server-token'
|
|
||||||
import toolPlugin, {
|
|
||||||
connect,
|
|
||||||
initializeWorkspace,
|
|
||||||
initModel,
|
|
||||||
updateModel,
|
|
||||||
prepareTools,
|
|
||||||
upgradeModel
|
|
||||||
} from '@hcengineering/server-tool'
|
|
||||||
import { pbkdf2Sync, randomBytes } from 'crypto'
|
|
||||||
import { Binary, Db, Filter, ObjectId, type MongoClient } from 'mongodb'
|
|
||||||
import fetch from 'node-fetch'
|
|
||||||
import otpGenerator from 'otp-generator'
|
|
||||||
import {
|
import {
|
||||||
DummyFullTextAdapter,
|
DummyFullTextAdapter,
|
||||||
Pipeline,
|
Pipeline,
|
||||||
@ -78,6 +64,20 @@ import {
|
|||||||
registerServerPlugins,
|
registerServerPlugins,
|
||||||
registerStringLoaders
|
registerStringLoaders
|
||||||
} from '@hcengineering/server-pipeline'
|
} from '@hcengineering/server-pipeline'
|
||||||
|
import { buildStorageFromConfig, storageConfigFromEnv } from '@hcengineering/server-storage'
|
||||||
|
import { decodeToken, generateToken } from '@hcengineering/server-token'
|
||||||
|
import toolPlugin, {
|
||||||
|
connect,
|
||||||
|
initializeWorkspace,
|
||||||
|
initModel,
|
||||||
|
prepareTools,
|
||||||
|
updateModel,
|
||||||
|
upgradeModel
|
||||||
|
} from '@hcengineering/server-tool'
|
||||||
|
import { pbkdf2Sync, randomBytes } from 'crypto'
|
||||||
|
import { Binary, Db, Filter, ObjectId, type MongoClient } from 'mongodb'
|
||||||
|
import fetch from 'node-fetch'
|
||||||
|
import otpGenerator from 'otp-generator'
|
||||||
|
|
||||||
import { accountPlugin } from './plugin'
|
import { accountPlugin } from './plugin'
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ export async function checkInvite (ctx: MeasureContext, invite: Invite | null, e
|
|||||||
Analytics.handleError(new Error(`no invite or invite limit exceed ${email}`))
|
Analytics.handleError(new Error(`no invite or invite limit exceed ${email}`))
|
||||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||||
}
|
}
|
||||||
if (invite.exp < Date.now()) {
|
if (invite.exp !== -1 && invite.exp < Date.now()) {
|
||||||
ctx.error('invite', { email, state: 'link expired' })
|
ctx.error('invite', { email, state: 'link expired' })
|
||||||
Analytics.handleError(new Error(`invite link expired ${invite._id.toString()} ${email}`))
|
Analytics.handleError(new Error(`invite link expired ${invite._id.toString()} ${email}`))
|
||||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.ExpiredLink, {}))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.ExpiredLink, {}))
|
||||||
@ -1577,7 +1577,7 @@ export async function getInviteLink (
|
|||||||
ctx.info('Getting invite link', { workspace: workspace.name, emailMask, limit })
|
ctx.info('Getting invite link', { workspace: workspace.name, emailMask, limit })
|
||||||
const data: Omit<Invite, '_id'> = {
|
const data: Omit<Invite, '_id'> = {
|
||||||
workspace,
|
workspace,
|
||||||
exp: Date.now() + exp,
|
exp: exp < 0 ? -1 : Date.now() + exp,
|
||||||
emailMask,
|
emailMask,
|
||||||
limit,
|
limit,
|
||||||
role: role ?? AccountRole.User
|
role: role ?? AccountRole.User
|
||||||
|
Loading…
Reference in New Issue
Block a user