Optimize authentication api
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package top.fatweb.oxygen.api.param
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
|
||||
/**
|
||||
* Captcha code parameter
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
open class CaptchaCodeParam {
|
||||
/**
|
||||
* Captcha code
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "验证码", required = true)
|
||||
@field:NotBlank(message = "Captcha code can not be blank")
|
||||
var captchaCode: String? = null
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
|
||||
/**
|
||||
* Forget password parameters
|
||||
@@ -22,4 +23,4 @@ data class ForgetParam(
|
||||
@field:NotBlank(message = "Email can not be blank")
|
||||
@field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
|
||||
val email: String?
|
||||
)
|
||||
) : CaptchaCodeParam()
|
||||
|
||||
@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.permission
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
|
||||
/**
|
||||
* Login parameters
|
||||
@@ -29,15 +30,5 @@ data class LoginParam(
|
||||
*/
|
||||
@Schema(description = "密码", required = true)
|
||||
@field:NotBlank(message = "Password can not be blank")
|
||||
val password: String?,
|
||||
|
||||
/**
|
||||
* Captcha code
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "验证码", required = true)
|
||||
@field:NotBlank(message = "Captcha code can not be blank")
|
||||
val captchaCode: String?
|
||||
)
|
||||
val password: String?
|
||||
) : CaptchaCodeParam()
|
||||
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.Pattern
|
||||
import jakarta.validation.constraints.Size
|
||||
import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
|
||||
/**
|
||||
* Register parameters
|
||||
@@ -45,4 +46,4 @@ data class RegisterParam(
|
||||
@field:NotBlank(message = "Password can not be blank")
|
||||
@field:Size(min = 10, max = 30)
|
||||
val password: String?
|
||||
)
|
||||
) : CaptchaCodeParam()
|
||||
@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import jakarta.validation.constraints.Size
|
||||
import top.fatweb.oxygen.api.param.CaptchaCodeParam
|
||||
|
||||
/**
|
||||
* Retrieve password parameters
|
||||
@@ -32,4 +33,4 @@ data class RetrieveParam(
|
||||
@field:NotBlank(message = "New password can not be blank")
|
||||
@field:Size(min = 10, max = 30)
|
||||
val password: String?
|
||||
)
|
||||
) : CaptchaCodeParam()
|
||||
|
||||
Reference in New Issue
Block a user