Authored by zhaoyue

Add openid login return token;unbind pwd is necessary

... ... @@ -17,7 +17,7 @@ public class TokenModel {
private String token;
//使用openId 登录时,会返回该用户openid对应的account。
private String account;
private String username;
public TokenModel(String userId, String token) {
this.userId = userId;
... ... @@ -40,11 +40,11 @@ public class TokenModel {
this.token = token;
}
public String getAccount() {
return account;
public String getUsername() {
return username;
}
public void setAccount(String account) {
this.account = account;
public void setUsername(String username) {
this.username = username;
}
}
... ...
... ... @@ -122,7 +122,7 @@ public class OpenIdController {
TokenModel model = tokenManager.createToken(String.valueOf(accountId));
User user = userRepository.findOne(accountId);
if (user.isStatus() == true) {
model.setAccount(user.getLoginAccount());
model.setUsername(user.getLoginAccount());
return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK);
} else {
return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK);
... ...
... ... @@ -54,7 +54,7 @@ public class TokenController {
}
//生成一个token,保存用户登录状态
TokenModel model = tokenManager.createToken(String.valueOf(user.getId()));
model.setAccount(user.getLoginAccount());
model.setUsername(user.getLoginAccount());
return new ResponseEntity<>(ResultModel.ok(model), HttpStatus.OK);
}
... ...