|
|
@@ -1,49 +0,0 @@
|
|
|
-package seecoder.devcloud.web.model.vo.user;
|
|
|
-
|
|
|
-import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.Builder;
|
|
|
-import lombok.Data;
|
|
|
-import lombok.NoArgsConstructor;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-
|
|
|
-import javax.validation.constraints.Email;
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
-import javax.validation.constraints.Pattern;
|
|
|
-
|
|
|
-@Data
|
|
|
-@NoArgsConstructor
|
|
|
-@AllArgsConstructor
|
|
|
-@Builder
|
|
|
-public class RegisterVO {
|
|
|
- //@Email(message = "用户名也要填邮箱名称!")
|
|
|
- @NotNull(groups = {PostMapping.class},message = "请填写用户名!")
|
|
|
- private String username="default";
|
|
|
- @Email(message = "邮箱格式不正确!")
|
|
|
-// @NotNull(message = "请填写邮箱!")
|
|
|
- @JsonIgnore
|
|
|
- private String email;
|
|
|
- @Pattern(groups = {PostMapping.class},regexp = "[0-9a-zA-Z_]{8,16}", message = "密码只能包含大小写字母、数字和下划线,且必须为8-16位!")
|
|
|
- @NotNull(groups = {PostMapping.class},message = "请填写密码!")
|
|
|
- private String password;
|
|
|
- @Pattern(regexp = "^\\w+${4,23}", message = "昵称只能包含大小写字母、数字和下划线,且必须为4-23位!")
|
|
|
- private String nickname="nickname";
|
|
|
-
|
|
|
- public RegisterVO(@Email(message = "邮箱格式不正确!") @NotNull(message = "请填写邮箱!") String username, @Pattern(regexp = "[0-9a-zA-Z_]{8,16}", message = "密码只能包含大小写字母、数字和下划线,且必须为8-16位!") @NotNull(message = "请填写密码!") String password, String nickname) {
|
|
|
- this.email = username;
|
|
|
- this.username=buildUsername(username);
|
|
|
- this.password = password;
|
|
|
- this.nickname = nickname;
|
|
|
- }
|
|
|
- public void buildUsername(){
|
|
|
- this.username=buildUsername(this.email);
|
|
|
- }
|
|
|
- public static String buildUsername(@Email(groups = {PostMapping.class},message = "邮箱格式不正确!") @NotNull(groups = {PostMapping.class},message = "请填写用户名!")String email){
|
|
|
- return email.replace("@","_").replaceAll("\\.","_");
|
|
|
- }
|
|
|
-
|
|
|
- public void setUsername(String username) {
|
|
|
- this.email = username;
|
|
|
- this.username=buildUsername(username);
|
|
|
- }
|
|
|
-}
|