Skip to content

Commit

Permalink
注册后自动登录
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangke committed Jan 4, 2018
1 parent 94e3ef8 commit b5f661e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ public void close() throws IOException {
public static void userLogin(Long userId) throws IOException {

OnlineUsersWebSocket client = cacheOfClients.get(userId);
cacheOfClients.remove(userId);

onlineClients.put(userId, client);

cacheOfClients.remove(userId);

//通知客户端登陆成功
OutMessage message = new OutMessage();
message.setUserId(userId);
Expand Down
5 changes: 5 additions & 0 deletions vm-frontend/src/main/resources/static/components/head.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ var Head = React.createClass({
},
onRegistSuccess: function (user) {
this.updateStateUser(user);
//open ws
this.wsOpen(user.id, function () {
//ajax ws
this.wsLogin();
}.bind(this));
},
updateStateUser(user){
//when login success reset user
Expand Down
5 changes: 5 additions & 0 deletions vm-frontend/src/main/resources/static/dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30659,6 +30659,11 @@ var Head = _react2.default.createClass({
},
onRegistSuccess: function onRegistSuccess(user) {
this.updateStateUser(user);
//open ws
this.wsOpen(user.id, function () {
//ajax ws
this.wsLogin();
}.bind(this));
},
updateStateUser: function updateStateUser(user) {
//when login success reset user
Expand Down

0 comments on commit b5f661e

Please sign in to comment.