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
2fed1a15
authored
May 08, 2024
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update user (#230)
parent
4a2e9695
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
model/user.go
+7
-4
No files found.
model/user.go
View file @
2fed1a15
...
...
@@ -253,14 +253,17 @@ func (user *User) Edit(updatePassword bool) error {
}
}
newUser
:=
*
user
DB
.
First
(
&
user
,
user
.
Id
)
err
=
DB
.
Model
(
user
)
.
Updates
(
map
[
string
]
interface
{}{
updates
:=
map
[
string
]
interface
{}{
"username"
:
newUser
.
Username
,
"password"
:
newUser
.
Password
,
"display_name"
:
newUser
.
DisplayName
,
"group"
:
newUser
.
Group
,
"quota"
:
newUser
.
Quota
,
})
.
Error
}
if
updatePassword
{
updates
[
"password"
]
=
newUser
.
Password
}
DB
.
First
(
&
user
,
user
.
Id
)
err
=
DB
.
Model
(
user
)
.
Updates
(
updates
)
.
Error
if
err
==
nil
{
if
common
.
RedisEnabled
{
_
=
common
.
RedisSet
(
fmt
.
Sprintf
(
"user_group:%d"
,
user
.
Id
),
user
.
Group
,
time
.
Duration
(
UserId2GroupCacheSeconds
)
*
time
.
Second
)
...
...
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