Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
eba23c4f
Unverified
Commit
eba23c4f
authored
Nov 29, 2022
by
Zeng1998
Committed by
GitHub
Nov 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add validation for user information update (#633)
parent
00fe6d38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
UpdateAccountDialog.tsx
web/src/components/UpdateAccountDialog.tsx
+14
-0
No files found.
web/src/components/UpdateAccountDialog.tsx
View file @
eba23c4f
...
@@ -6,6 +6,14 @@ import { userService } from "../services";
...
@@ -6,6 +6,14 @@ import { userService } from "../services";
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
{
validate
,
ValidatorConfig
}
from
"../helpers/validator"
;
const
validateConfig
:
ValidatorConfig
=
{
minLength
:
4
,
maxLength
:
320
,
noSpace
:
true
,
noChinese
:
true
,
};
type
Props
=
DialogProps
;
type
Props
=
DialogProps
;
...
@@ -63,6 +71,12 @@ const UpdateAccountDialog: React.FC<Props> = ({ destroy }: Props) => {
...
@@ -63,6 +71,12 @@ const UpdateAccountDialog: React.FC<Props> = ({ destroy }: Props) => {
return
;
return
;
}
}
const
usernameValidResult
=
validate
(
state
.
username
,
validateConfig
);
if
(
!
usernameValidResult
.
result
)
{
toastHelper
.
error
(
t
(
"common.username"
)
+
": "
+
usernameValidResult
.
reason
);
return
;
}
try
{
try
{
const
user
=
userService
.
getState
().
user
as
User
;
const
user
=
userService
.
getState
().
user
as
User
;
const
userPatch
:
UserPatch
=
{
const
userPatch
:
UserPatch
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment