From c82608125353a7cd96aa19c2c96ac7a40d1ec23f Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期一, 07 六月 2021 18:09:36 +0800
Subject: [PATCH] 关闭接口鉴权与自动一起使用可以完成单网页集成

---
 src/main/java/com/genersoft/iot/vmp/web/AuthController.java |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/web/AuthController.java b/src/main/java/com/genersoft/iot/vmp/web/AuthController.java
index 50e4da1..f4a2af8 100644
--- a/src/main/java/com/genersoft/iot/vmp/web/AuthController.java
+++ b/src/main/java/com/genersoft/iot/vmp/web/AuthController.java
@@ -1,10 +1,8 @@
 package com.genersoft.iot.vmp.web;
 
-import com.genersoft.iot.vmp.gb28181.bean.Device;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.util.StringUtils;
+import com.genersoft.iot.vmp.service.IUserService;
+import com.genersoft.iot.vmp.storager.dao.dto.User;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 @CrossOrigin
@@ -12,19 +10,16 @@
 @RequestMapping(value = "/auth")
 public class AuthController {
 
-    @Value("${auth.username}")
-    private String username;
-
-    @Value("${auth.password}")
-    private String password;
+    @Autowired
+    private IUserService userService;
 
     @RequestMapping("/login")
-    public Object devices(String username, String password){
-        if (!StringUtils.isEmpty(username) && username.equals(username)
-                && !StringUtils.isEmpty(password) && password.equals(password)) {
+    public String devices(String name, String passwd){
+        User user = userService.getUser(name, passwd);
+        if (user != null) {
             return "success";
         }else {
-            return "fait";
+            return "fail";
         }
     }
 }

--
Gitblit v1.8.0