Authored by zhaoyue

Add openid login return token;unbind pwd is necessary

@@ -17,7 +17,7 @@ public class TokenModel { @@ -17,7 +17,7 @@ public class TokenModel {
17 private String token; 17 private String token;
18 18
19 //使用openId 登录时,会返回该用户openid对应的account。 19 //使用openId 登录时,会返回该用户openid对应的account。
20 - private String account; 20 + private String username;
21 21
22 public TokenModel(String userId, String token) { 22 public TokenModel(String userId, String token) {
23 this.userId = userId; 23 this.userId = userId;
@@ -40,11 +40,11 @@ public class TokenModel { @@ -40,11 +40,11 @@ public class TokenModel {
40 this.token = token; 40 this.token = token;
41 } 41 }
42 42
43 - public String getAccount() {  
44 - return account; 43 + public String getUsername() {
  44 + return username;
45 } 45 }
46 46
47 - public void setAccount(String account) {  
48 - this.account = account; 47 + public void setUsername(String username) {
  48 + this.username = username;
49 } 49 }
50 } 50 }
@@ -122,7 +122,7 @@ public class OpenIdController { @@ -122,7 +122,7 @@ public class OpenIdController {
122 TokenModel model = tokenManager.createToken(String.valueOf(accountId)); 122 TokenModel model = tokenManager.createToken(String.valueOf(accountId));
123 User user = userRepository.findOne(accountId); 123 User user = userRepository.findOne(accountId);
124 if (user.isStatus() == true) { 124 if (user.isStatus() == true) {
125 - model.setAccount(user.getLoginAccount()); 125 + model.setUsername(user.getLoginAccount());
126 return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK); 126 return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK);
127 } else { 127 } else {
128 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK); 128 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK);
@@ -54,7 +54,7 @@ public class TokenController { @@ -54,7 +54,7 @@ public class TokenController {
54 } 54 }
55 //生成一个token,保存用户登录状态 55 //生成一个token,保存用户登录状态
56 TokenModel model = tokenManager.createToken(String.valueOf(user.getId())); 56 TokenModel model = tokenManager.createToken(String.valueOf(user.getId()));
57 - model.setAccount(user.getLoginAccount()); 57 + model.setUsername(user.getLoginAccount());
58 return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK); 58 return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK);
59 } 59 }
60 60