feat:check userName and password (#955)

pull/956/head
WuLang 2 years ago committed by GitHub
parent fcf719ce1a
commit cf5613b80c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,6 +44,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>

@ -19,23 +19,28 @@ package cn.hippo4j.auth.model.biz.user;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
/**
* User req dto.
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UserReqDTO extends Page {
/**
* userName
*/
@Length(max = 64, message = "用户名最长为64个字符")
private String userName;
/**
* password
*/
@Length(min = 6, message = "密码最少为6个字符")
private String password;
/**

@ -29,6 +29,7 @@ import cn.hippo4j.common.web.base.Result;
import cn.hippo4j.common.web.base.Results;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -74,7 +75,7 @@ public class UserController {
}
@PostMapping("/add")
public Result<Void> addUser(@RequestBody UserReqDTO reqDTO) {
public Result<Void> addUser(@Validated @RequestBody UserReqDTO reqDTO) {
userService.addUser(reqDTO);
return Results.success();
}

Loading…
Cancel
Save