feat: complete reverse engineering, standard Maven structure, detailed code annotations and IoT-M platform architecture

This commit is contained in:
rick committed 2026-11-16 14:35:53 +08:00
1 parent e8dc09fb3c
commit cd6a4c70e7
3045 files changed
+566733 -1

No files matched your search

@@ -0,0 +1,60 @@
package com.midm.controller;
import com.midm.model.org.User;
import com.midm.model.org.UserToken;
import com.mitac.cell.utils.McUuidUtils;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.server.NotAcceptableStatusException;
@Controller
public class UserController extends BaseController {
@RequestMapping(
value = {"/resetPassword"},
method = {RequestMethod.GET}
)
public String home(HttpServletRequest request, HttpServletResponse response, Authentication authentication, Model model, @RequestParam(name = "token") String passwordTokenUid, @RequestParam(required = false) String language) {
this.init(request, response, authentication, language);
model.addAttribute("theme", this.theme);
UUID passwordTokenUuid = McUuidUtils.toUuidFromBase64(passwordTokenUid);
UserToken token = this.userService.findToken(passwordTokenUuid);
if (token != null && token.isExpired()) {
this.userService.deleteTokenByType(token);
}
if (token != null && token.getTokenType() == 'P') {
model.addAttribute("error", false);
User user = this.userService.findUserByUserUuid(token.getUserUuid());
model.addAttribute("token", token);
model.addAttribute("user", user);
return this.getView(authentication, "/resetPassword");
} else {
model.addAttribute("error", true);
return this.getView(authentication, "/resetPassword");
}
}
@RequestMapping(
value = {"/keepSession"},
method = {RequestMethod.GET},
produces = {"text/plain"}
)
@ResponseBody
public String getSettings(HttpServletRequest request, Authentication authentication, @RequestHeader(value = "Authorization",required = false) String accessToken) {
User loggedUser = this.userService.authorizedUser(authentication, accessToken);
if (loggedUser == null) {
throw new NotAcceptableStatusException("");
} else {
return "ok";
}
}
}