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
53ccf4ae
Unverified
Commit
53ccf4ae
authored
Feb 08, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎸
更新用户 B3 Key
parent
cbb19eb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
src/main/java/org/b3log/solo/processor/console/UserConsole.java
...in/java/org/b3log/solo/processor/console/UserConsole.java
+2
-1
src/main/java/org/b3log/solo/service/UserMgmtService.java
src/main/java/org/b3log/solo/service/UserMgmtService.java
+15
-6
No files found.
src/main/java/org/b3log/solo/processor/console/UserConsole.java
View file @
53ccf4ae
...
...
@@ -180,7 +180,8 @@ public class UserConsole {
* "oId": "",
* "userName": "",
* "userEmail": "",
* "roleName": ""
* "roleName": "",
* ....
* }, ....]
* "sc": true
* }
...
...
src/main/java/org/b3log/solo/service/UserMgmtService.java
View file @
53ccf4ae
...
...
@@ -42,7 +42,7 @@ import org.json.JSONObject;
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/DASHU">DASHU</a>
* @author <a href="https://github.com/nanolikeyou">nanolikeyou</a>
* @version 1.1.0.1
5, Oct 19, 2018
* @version 1.1.0.1
6, Feb 8, 2019
* @since 0.4.0
*/
@Service
...
...
@@ -105,10 +105,8 @@ public class UserMgmtService {
}
final
String
userNewEmail
=
requestJSONObject
.
optString
(
User
.
USER_EMAIL
).
toLowerCase
().
trim
();
// Check email is whether duplicated
final
JSONObject
mayBeAnother
=
userRepository
.
getByEmail
(
userNewEmail
);
JSONObject
mayBeAnother
=
userRepository
.
getByEmail
(
userNewEmail
);
if
(
null
!=
mayBeAnother
&&
!
mayBeAnother
.
optString
(
Keys
.
OBJECT_ID
).
equals
(
oldUserId
))
{
// Exists someone else has the save email as requested
throw
new
ServiceException
(
langPropsService
.
get
(
"duplicatedEmailLabel"
));
}
...
...
@@ -118,6 +116,10 @@ public class UserMgmtService {
if
(
UserExt
.
invalidUserName
(
userName
))
{
throw
new
ServiceException
(
langPropsService
.
get
(
"userNameInvalidLabel"
));
}
mayBeAnother
=
userRepository
.
getByUserName
(
userName
);
if
(
null
!=
mayBeAnother
&&
!
mayBeAnother
.
optString
(
Keys
.
OBJECT_ID
).
equals
(
oldUserId
))
{
throw
new
ServiceException
(
langPropsService
.
get
(
"duplicatedUserNameLabel"
));
}
oldUser
.
put
(
User
.
USER_NAME
,
userName
);
final
String
userRole
=
requestJSONObject
.
optString
(
User
.
USER_ROLE
);
...
...
@@ -190,8 +192,9 @@ public class UserMgmtService {
* "userEmail": "",
* "userURL": "", // optional, uses 'servePath' instead if not specified
* "userRole": "", // optional, uses {@value Role#DEFAULT_ROLE} instead if not specified
* "userAvatar": "" // optional, users generated gravatar url instead if not specified
* ,see {@link User} for more details
* "userAvatar": "", // optional, users generated gravatar url instead if not specified
* "userGitHubId": "",
* "userB3Key": ""
* @return generated user id
* @throws ServiceException service exception
*/
...
...
@@ -250,6 +253,12 @@ public class UserMgmtService {
}
user
.
put
(
UserExt
.
USER_AVATAR
,
userAvatar
);
final
String
userGitHubId
=
requestJSONObject
.
optString
(
UserExt
.
USER_GITHUB_ID
);
user
.
put
(
UserExt
.
USER_GITHUB_ID
,
userGitHubId
);
final
String
userB3Key
=
requestJSONObject
.
optString
(
UserExt
.
USER_B3_KEY
);
user
.
put
(
UserExt
.
USER_B3_KEY
,
userB3Key
);
userRepository
.
add
(
user
);
transaction
.
commit
();
...
...
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