use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server-android-client by youngmonkeys.
the class EzyAppExitHandler method handle.
@Override
public void handle(EzyArray data) {
EzyZone zone = client.getZone();
EzyAppManager appManager = zone.getAppManager();
int appId = data.get(0, int.class);
int reasonId = data.get(1, int.class);
EzyApp app = appManager.removeApp(appId);
EzyLogger.info("user exit app: " + app + " reason: " + reasonId);
postHandle(app, data);
}
use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-examples by tvd12.
the class GoogleService method getUserInfoByAccessToken.
@Override
public Userinfo getUserInfoByAccessToken(String accessTokenStr) {
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessTokenStr);
Oauth2 oauth2 = new Oauth2.Builder(new NetHttpTransport(), new GsonFactory(), credential).setApplicationName("Oauth2").build();
try {
return oauth2.userinfo().get().execute();
} catch (Exception e) {
logger.info("get google user information by access token error", e);
return null;
}
}
use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-examples by tvd12.
the class RegisterController method registerPost.
@DoPost("/register")
public Redirect registerPost(@RequestBody RegisterRequest request) {
final User user = new User(request.getUsername(), request.getPassword(), request.getBirthOfDate(), LocalDate.now(), LocalDateTime.now());
userService.addUser(user);
return Redirect.to("/user/" + request.getUsername());
}
use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-examples by tvd12.
the class UserController method userSavePost.
@DoPost("/user/save")
public Object userSavePost(@UserId long userId, @RequestBody UpdateUserRequest request) {
User user = userService.getUserById(userId);
if (user == null) {
throw new UserNotFoundException("user with id: " + userId + " not found");
}
user.setEmail(request.getEmail());
user.setFullName(request.getFirstName() + " " + request.getLastName());
user.setFirstName(request.getFirstName());
user.setLastName(request.getLastName());
user.setStatus(UserStatus.UPDATED);
user.setPassword(EzySHA256.cryptUtfToLowercase(request.getPassword()));
userService.saveUser(user);
return Redirect.builder().uri("/home").build();
}
Aggregations