Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
solo-1
Commits
cbb19eb1
Unverified
Commit
cbb19eb1
authored
Feb 08, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
更新用户 B3 Key
parent
deeae5f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
19 deletions
+20
-19
src/main/java/org/b3log/solo/processor/console/UserConsole.java
...in/java/org/b3log/solo/processor/console/UserConsole.java
+4
-3
src/main/java/org/b3log/solo/service/UserMgmtService.java
src/main/java/org/b3log/solo/service/UserMgmtService.java
+9
-14
src/main/webapp/admin/admin-user-list.ftl
src/main/webapp/admin/admin-user-list.ftl
+4
-1
src/main/webapp/js/admin/userList.js
src/main/webapp/js/admin/userList.js
+3
-1
No files found.
src/main/java/org/b3log/solo/processor/console/UserConsole.java
View file @
cbb19eb1
...
@@ -87,9 +87,10 @@ public class UserConsole {
...
@@ -87,9 +87,10 @@ public class UserConsole {
* "oId": "",
* "oId": "",
* "userName": "",
* "userName": "",
* "userEmail": "",
* "userEmail": "",
* "userRole": "", // optional
* "userRole": "",
* "userURL": "", // optional
* "userURL": "",
* "userAvatar": "" // optional
* "userAvatar": "",
* "userB3Key": ""
* }
* }
* </pre>
* </pre>
* </p>
* </p>
...
...
src/main/java/org/b3log/solo/service/UserMgmtService.java
View file @
cbb19eb1
...
@@ -89,8 +89,9 @@ public class UserMgmtService {
...
@@ -89,8 +89,9 @@ public class UserMgmtService {
* "oId": "",
* "oId": "",
* "userName": "",
* "userName": "",
* "userEmail": "",
* "userEmail": "",
* "userRole": "", // optional
* "userRole": "",
* "userURL": "", // optional
* "userURL": "",
* "userB3Key": ""
* @throws ServiceException service exception
* @throws ServiceException service exception
*/
*/
public
void
updateUser
(
final
JSONObject
requestJSONObject
)
throws
ServiceException
{
public
void
updateUser
(
final
JSONObject
requestJSONObject
)
throws
ServiceException
{
...
@@ -99,7 +100,6 @@ public class UserMgmtService {
...
@@ -99,7 +100,6 @@ public class UserMgmtService {
try
{
try
{
final
String
oldUserId
=
requestJSONObject
.
optString
(
Keys
.
OBJECT_ID
);
final
String
oldUserId
=
requestJSONObject
.
optString
(
Keys
.
OBJECT_ID
);
final
JSONObject
oldUser
=
userRepository
.
get
(
oldUserId
);
final
JSONObject
oldUser
=
userRepository
.
get
(
oldUserId
);
if
(
null
==
oldUser
)
{
if
(
null
==
oldUser
)
{
throw
new
ServiceException
(
langPropsService
.
get
(
"updateFailLabel"
));
throw
new
ServiceException
(
langPropsService
.
get
(
"updateFailLabel"
));
}
}
...
@@ -107,7 +107,6 @@ public class UserMgmtService {
...
@@ -107,7 +107,6 @@ public class UserMgmtService {
final
String
userNewEmail
=
requestJSONObject
.
optString
(
User
.
USER_EMAIL
).
toLowerCase
().
trim
();
final
String
userNewEmail
=
requestJSONObject
.
optString
(
User
.
USER_EMAIL
).
toLowerCase
().
trim
();
// Check email is whether duplicated
// Check email is whether duplicated
final
JSONObject
mayBeAnother
=
userRepository
.
getByEmail
(
userNewEmail
);
final
JSONObject
mayBeAnother
=
userRepository
.
getByEmail
(
userNewEmail
);
if
(
null
!=
mayBeAnother
&&
!
mayBeAnother
.
optString
(
Keys
.
OBJECT_ID
).
equals
(
oldUserId
))
{
if
(
null
!=
mayBeAnother
&&
!
mayBeAnother
.
optString
(
Keys
.
OBJECT_ID
).
equals
(
oldUserId
))
{
// Exists someone else has the save email as requested
// Exists someone else has the save email as requested
throw
new
ServiceException
(
langPropsService
.
get
(
"duplicatedEmailLabel"
));
throw
new
ServiceException
(
langPropsService
.
get
(
"duplicatedEmailLabel"
));
...
@@ -115,7 +114,6 @@ public class UserMgmtService {
...
@@ -115,7 +114,6 @@ public class UserMgmtService {
oldUser
.
put
(
User
.
USER_EMAIL
,
userNewEmail
);
oldUser
.
put
(
User
.
USER_EMAIL
,
userNewEmail
);
// Update
final
String
userName
=
requestJSONObject
.
optString
(
User
.
USER_NAME
);
final
String
userName
=
requestJSONObject
.
optString
(
User
.
USER_NAME
);
if
(
UserExt
.
invalidUserName
(
userName
))
{
if
(
UserExt
.
invalidUserName
(
userName
))
{
throw
new
ServiceException
(
langPropsService
.
get
(
"userNameInvalidLabel"
));
throw
new
ServiceException
(
langPropsService
.
get
(
"userNameInvalidLabel"
));
...
@@ -123,19 +121,16 @@ public class UserMgmtService {
...
@@ -123,19 +121,16 @@ public class UserMgmtService {
oldUser
.
put
(
User
.
USER_NAME
,
userName
);
oldUser
.
put
(
User
.
USER_NAME
,
userName
);
final
String
userRole
=
requestJSONObject
.
optString
(
User
.
USER_ROLE
);
final
String
userRole
=
requestJSONObject
.
optString
(
User
.
USER_ROLE
);
if
(
StringUtils
.
isNotBlank
(
userRole
))
{
oldUser
.
put
(
User
.
USER_ROLE
,
userRole
);
oldUser
.
put
(
User
.
USER_ROLE
,
userRole
);
}
final
String
userURL
=
requestJSONObject
.
optString
(
User
.
USER_URL
);
final
String
userURL
=
requestJSONObject
.
optString
(
User
.
USER_URL
);
if
(
StringUtils
.
isNotBlank
(
userURL
))
{
oldUser
.
put
(
User
.
USER_URL
,
userURL
);
oldUser
.
put
(
User
.
USER_URL
,
userURL
);
}
final
String
userAvatar
=
requestJSONObject
.
optString
(
UserExt
.
USER_AVATAR
);
final
String
userAvatar
=
requestJSONObject
.
optString
(
UserExt
.
USER_AVATAR
);
if
(!
StringUtils
.
equals
(
userAvatar
,
oldUser
.
optString
(
UserExt
.
USER_AVATAR
)))
{
oldUser
.
put
(
UserExt
.
USER_AVATAR
,
userAvatar
);
oldUser
.
put
(
UserExt
.
USER_AVATAR
,
userAvatar
);
}
final
String
userB3Key
=
requestJSONObject
.
optString
(
UserExt
.
USER_B3_KEY
);
oldUser
.
put
(
UserExt
.
USER_B3_KEY
,
userB3Key
);
userRepository
.
update
(
oldUserId
,
oldUser
);
userRepository
.
update
(
oldUserId
,
oldUser
);
transaction
.
commit
();
transaction
.
commit
();
...
...
src/main/webapp/admin/admin-user-list.ftl
View file @
cbb19eb1
...
@@ -31,7 +31,10 @@
...
@@ -31,7 +31,10 @@
<label for="userURLUpdate">${userURL1Label}</label>
<label for="userURLUpdate">${userURL1Label}</label>
<input id="userURLUpdate" type="text"/>
<input id="userURLUpdate" type="text"/>
<label for="userAvatarUpdate">${userAvatar1Label}</label>
<label for="userAvatarUpdate">${userAvatar1Label}</label>
<input id="userAvatarUpdate" type="text"/> <br><br>
<input id="userAvatarUpdate" type="text"/>
<label for="userB3KeyUpdate">B3 Key</label>
<input id="userB3KeyUpdate" type="text"/>
<br><br>
<button onclick="admin.userList.update();" class="right">${updateLabel}</button>
<button onclick="admin.userList.update();" class="right">${updateLabel}</button>
<div class="clear"></div>
<div class="clear"></div>
</div>
</div>
...
...
src/main/webapp/js/admin/userList.js
View file @
cbb19eb1
...
@@ -154,6 +154,7 @@ admin.userList = {
...
@@ -154,6 +154,7 @@ admin.userList = {
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
$userEmailUpdate
.
val
(
result
.
user
.
userEmail
);
$
(
"
#userURLUpdate
"
).
val
(
result
.
user
.
userURL
);
$
(
"
#userURLUpdate
"
).
val
(
result
.
user
.
userURL
);
$
(
"
#userAvatarUpdate
"
).
val
(
result
.
user
.
userAvatar
);
$
(
"
#userAvatarUpdate
"
).
val
(
result
.
user
.
userAvatar
);
$
(
"
#userB3KeyUpdate
"
).
val
(
result
.
user
.
userB3Key
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
}
}
...
@@ -174,7 +175,8 @@ admin.userList = {
...
@@ -174,7 +175,8 @@ admin.userList = {
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userEmail
"
:
$
(
"
#userEmailUpdate
"
).
val
(),
"
userURL
"
:
$
(
"
#userURLUpdate
"
).
val
(),
"
userURL
"
:
$
(
"
#userURLUpdate
"
).
val
(),
"
userRole
"
:
userInfo
.
userRole
,
"
userRole
"
:
userInfo
.
userRole
,
"
userAvatar
"
:
$
(
"
#userAvatarUpdate
"
).
val
()
"
userAvatar
"
:
$
(
"
#userAvatarUpdate
"
).
val
(),
"
userB3Key
"
:
$
(
"
#userB3KeyUpdate
"
).
val
()
};
};
$
.
ajax
({
$
.
ajax
({
...
...
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