forked from nocobase/nocobase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): support signing in with username (nocobase#2376)
* feat(auth): support signing in with username * chore: compatibility && add INIT_ROOT_USERNAME * chore: add default username of root user * chore: add notice * fix: typo * chore: change rule of username * fix: sqlite add unique constraint --------- Co-authored-by: chenos <[email protected]>
- Loading branch information
Showing
28 changed files
with
289 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ DB_TABLE_PREFIX= | |
INIT_ROOT_EMAIL=[email protected] | ||
INIT_ROOT_PASSWORD=admin123 | ||
INIT_ROOT_NICKNAME=Super Admin | ||
INIT_ROOT_USERNAME=nocobase | ||
|
||
# local or ali-oss | ||
DEFAULT_STORAGE_TYPE=local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ DB_STORAGE=storage/db/nocobase-test.sqlite | |
[email protected] | ||
INIT_ROOT_PASSWORD=admin123 | ||
INIT_ROOT_NICKNAME=Super Admin | ||
INIT_ROOT_USERNAME=nocobase | ||
|
||
# local or ali-oss | ||
DEFAULT_STORAGE_TYPE=local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/core/client/src/collection-manager/interfaces/username.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { i18n } from '../../i18n'; | ||
import { defaultProps, operators, unique } from './properties'; | ||
import { IField } from './types'; | ||
import { registerValidateRules } from '@formily/core'; | ||
|
||
registerValidateRules({ | ||
username(value) { | ||
return /^[^@.<>"'/]{2,16}$/.test(value) || i18n.t('2 to 16 characters (excluding @.<>"\'/)'); | ||
}, | ||
}); | ||
|
||
export const username: IField = { | ||
name: 'username', | ||
type: 'object', | ||
group: 'basic', | ||
order: 1, | ||
title: '{{t("Username")}}', | ||
sortable: true, | ||
default: { | ||
type: 'string', | ||
// name, | ||
uiSchema: { | ||
type: 'string', | ||
// title, | ||
'x-component': 'Input', | ||
'x-validator': { username: true }, | ||
required: true, | ||
}, | ||
}, | ||
availableTypes: ['string'], | ||
hasDefaultValue: false, | ||
properties: { | ||
...defaultProps, | ||
unique, | ||
}, | ||
filterable: { | ||
operators: operators.string, | ||
}, | ||
titleUsable: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ DB_DIALECT={{{env.DB_DIALECT}}} | |
[email protected] | ||
INIT_ROOT_PASSWORD=admin123 | ||
INIT_ROOT_NICKNAME=Super Admin | ||
INIT_ROOT_USERNAME=nocobase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.