Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7fff6576
authored
Sep 29, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remind user to change default password (close #516)
parent
8f4b357f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
web/src/components/LoginForm.js
+11
-5
web/src/pages/User/EditUser.js
+1
-1
No files found.
web/src/components/LoginForm.js
View file @
7fff6576
...
@@ -2,8 +2,8 @@ import React, { useContext, useEffect, useState } from 'react';
...
@@ -2,8 +2,8 @@ import React, { useContext, useEffect, useState } from 'react';
import
{
Button
,
Divider
,
Form
,
Grid
,
Header
,
Image
,
Message
,
Modal
,
Segment
}
from
'semantic-ui-react'
;
import
{
Button
,
Divider
,
Form
,
Grid
,
Header
,
Image
,
Message
,
Modal
,
Segment
}
from
'semantic-ui-react'
;
import
{
Link
,
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
Link
,
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
UserContext
}
from
'../context/User'
;
import
{
UserContext
}
from
'../context/User'
;
import
{
API
,
getLogo
,
showError
,
showSuccess
}
from
'../helpers'
;
import
{
API
,
getLogo
,
showError
,
showSuccess
,
showWarning
}
from
'../helpers'
;
import
{
getOAuthState
,
onGitHubOAuthClicked
}
from
'./utils'
;
import
{
onGitHubOAuthClicked
}
from
'./utils'
;
const
LoginForm
=
()
=>
{
const
LoginForm
=
()
=>
{
const
[
inputs
,
setInputs
]
=
useState
({
const
[
inputs
,
setInputs
]
=
useState
({
...
@@ -68,8 +68,14 @@ const LoginForm = () => {
...
@@ -68,8 +68,14 @@ const LoginForm = () => {
if
(
success
)
{
if
(
success
)
{
userDispatch
({
type
:
'login'
,
payload
:
data
});
userDispatch
({
type
:
'login'
,
payload
:
data
});
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
));
navigate
(
'/'
);
if
(
username
===
'root'
&&
password
===
'123456'
)
{
showSuccess
(
'登录成功!'
);
navigate
(
'/user/edit'
);
showSuccess
(
'登录成功!'
);
showWarning
(
'请立刻修改默认密码!'
);
}
else
{
navigate
(
'/token'
);
showSuccess
(
'登录成功!'
);
}
}
else
{
}
else
{
showError
(
message
);
showError
(
message
);
}
}
...
@@ -126,7 +132,7 @@ const LoginForm = () => {
...
@@ -126,7 +132,7 @@ const LoginForm = () => {
circular
circular
color
=
'black'
color
=
'black'
icon
=
'github'
icon
=
'github'
onClick
=
{()
=>
onGitHubOAuthClicked
(
status
.
github_client_id
)}
onClick
=
{()
=>
onGitHubOAuthClicked
(
status
.
github_client_id
)}
/
>
/
>
)
:
(
)
:
(
<><
/
>
<><
/
>
...
...
web/src/pages/User/EditUser.js
View file @
7fff6576
...
@@ -102,7 +102,7 @@ const EditUser = () => {
...
@@ -102,7 +102,7 @@ const EditUser = () => {
label
=
'密码'
label
=
'密码'
name
=
'password'
name
=
'password'
type
=
{
'password'
}
type
=
{
'password'
}
placeholder
=
{
'请输入新的密码'
}
placeholder
=
{
'请输入新的密码
,最短 8 位
'
}
onChange
=
{
handleInputChange
}
onChange
=
{
handleInputChange
}
value
=
{
password
}
value
=
{
password
}
autoComplete
=
'new-password'
autoComplete
=
'new-password'
...
...
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