mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 04:22:37 +10:00
Set default language on invitation signup (#691)
* Default language selection to en-US if locale is undefined (Client)
This commit is contained in:
@ -47,7 +47,7 @@ function LanguageSwitcher() {
|
|||||||
{ value: "pt-BR", label: "Português (Brazilian)" },
|
{ value: "pt-BR", label: "Português (Brazilian)" },
|
||||||
{ value: "zh-CN", label: "中文 (简体)" },
|
{ value: "zh-CN", label: "中文 (简体)" },
|
||||||
]}
|
]}
|
||||||
value={language}
|
value={language || 'en-US'}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
allowDeselect={false}
|
allowDeselect={false}
|
||||||
checkIconPosition="right"
|
checkIconPosition="right"
|
||||||
|
|||||||
@ -168,20 +168,18 @@ export class WorkspaceInvitationService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await executeTx(this.db, async (trx) => {
|
await executeTx(this.db, async (trx) => {
|
||||||
newUser = await trx
|
newUser = await this.userRepo.insertUser(
|
||||||
.insertInto('users')
|
{
|
||||||
.values({
|
|
||||||
name: dto.name,
|
name: dto.name,
|
||||||
email: invitation.email,
|
email: invitation.email,
|
||||||
password: password,
|
|
||||||
workspaceId: workspaceId,
|
|
||||||
role: invitation.role,
|
|
||||||
lastLoginAt: new Date(),
|
|
||||||
invitedById: invitation.invitedById,
|
|
||||||
emailVerifiedAt: new Date(),
|
emailVerifiedAt: new Date(),
|
||||||
})
|
password: password,
|
||||||
.returningAll()
|
role: invitation.role,
|
||||||
.executeTakeFirst();
|
invitedById: invitation.invitedById,
|
||||||
|
workspaceId: workspaceId,
|
||||||
|
},
|
||||||
|
trx,
|
||||||
|
);
|
||||||
|
|
||||||
// add user to default group
|
// add user to default group
|
||||||
await this.groupUserRepo.addUserToDefaultGroup(
|
await this.groupUserRepo.addUserToDefaultGroup(
|
||||||
|
|||||||
@ -99,7 +99,8 @@ export class UserRepo {
|
|||||||
trx?: KyselyTransaction,
|
trx?: KyselyTransaction,
|
||||||
): Promise<User> {
|
): Promise<User> {
|
||||||
const user: InsertableUser = {
|
const user: InsertableUser = {
|
||||||
name: insertableUser.name || insertableUser.email.toLowerCase(),
|
name:
|
||||||
|
insertableUser.name || insertableUser.email.split('@')[1].toLowerCase(),
|
||||||
email: insertableUser.email.toLowerCase(),
|
email: insertableUser.email.toLowerCase(),
|
||||||
password: await hashPassword(insertableUser.password),
|
password: await hashPassword(insertableUser.password),
|
||||||
locale: 'en-US',
|
locale: 'en-US',
|
||||||
@ -110,7 +111,7 @@ export class UserRepo {
|
|||||||
const db = dbOrTx(this.db, trx);
|
const db = dbOrTx(this.db, trx);
|
||||||
return db
|
return db
|
||||||
.insertInto('users')
|
.insertInto('users')
|
||||||
.values(user)
|
.values({ ...insertableUser, ...user })
|
||||||
.returningAll()
|
.returningAll()
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user