Compare commits
No commits in common. "af432040639b402c38c8dd246b06388e30735593" and "c358a43bcf20babd5cc0cdb225c7d409159302f4" have entirely different histories.
af43204063
...
c358a43bcf
@ -1,4 +1,4 @@
|
||||
@import "../styles/config";
|
||||
@import "../common.less";
|
||||
|
||||
#mainMenu {
|
||||
border-bottom: 1px solid black;
|
||||
@ -19,4 +19,12 @@
|
||||
background-color: lightskyblue;
|
||||
}
|
||||
|
||||
.userHasPassword {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.userNoPassword {
|
||||
color: indianred;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div class="tileContent">
|
||||
<table>
|
||||
<tr *ngFor="let user of group.usersByNameOwnerFirst()">
|
||||
<tr [class.user_owner]="group.isOwner(user)" *ngFor="let user of group.usersByNameOwnerFirst()">
|
||||
<td (click)="userService.goto(user)">
|
||||
{{ user.name }}
|
||||
</td>
|
||||
@ -77,7 +77,7 @@
|
||||
</div>
|
||||
<div class="tileContent">
|
||||
<table>
|
||||
<tr *ngFor="let user of group.bannedByName()">
|
||||
<tr [class.user_owner]="group.isOwner(user)" *ngFor="let user of group.bannedByName()">
|
||||
<td (click)="userService.goto(user)">
|
||||
{{ user.name }}
|
||||
</td>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../../styles/config";
|
||||
@import "../../../../common.less";
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
|
||||
@ -1 +1 @@
|
||||
@import "../../../../styles/config";
|
||||
@import "../../../../common.less";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../../../styles/config";
|
||||
@import "../../../../../common.less";
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
@import "../../../styles/config";
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
@import "../../../../styles/config";
|
||||
|
||||
.huge {
|
||||
font-size: 50vmin;
|
||||
white-space: nowrap;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../../../styles/config";
|
||||
@import "../../../../../common.less";
|
||||
|
||||
@page {
|
||||
size: A4;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../../styles/config";
|
||||
@import "../../../../common.less";
|
||||
|
||||
.name {
|
||||
text-align: left;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../../styles/config";
|
||||
@import "../../../../common.less";
|
||||
|
||||
#VoltageDropInputs {
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
@import "../../../styles/config";
|
||||
@import "../../../common.less";
|
||||
|
||||
@ -1 +1 @@
|
||||
@import "../../../styles/config";
|
||||
@import "../../../common";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "../../../styles/config";
|
||||
@import "../../../common.less";
|
||||
|
||||
.unsaved {
|
||||
background-color: yellow;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@import "./config";
|
||||
@import "./user.less";
|
||||
|
||||
.buttons {
|
||||
margin-bottom: @halfSpace;
|
||||
@ -1,4 +1,89 @@
|
||||
@import "./styles/basic";
|
||||
@import "./styles/tiles";
|
||||
@import "./styles/button";
|
||||
@import "./styles/user";
|
||||
@import "./common.less";
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 4vw;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
input {
|
||||
all: unset;
|
||||
background-color: white;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
|
||||
select {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.tileContainer {
|
||||
padding: @halfSpace;
|
||||
|
||||
.tile {
|
||||
width: 100%;
|
||||
padding: @halfSpace;
|
||||
|
||||
.tileInner {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: @space;
|
||||
background-color: #fbfbfb;
|
||||
|
||||
.tileTitle {
|
||||
font-weight: bold;
|
||||
padding: @halfSpace @space;
|
||||
background-color: lightskyblue;
|
||||
}
|
||||
|
||||
.tileContent {
|
||||
padding: @halfSpace;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
border: 0.2em solid white;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.tileFooter {
|
||||
padding: @halfSpace @space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 1000px) {
|
||||
|
||||
body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.tileContainer {
|
||||
|
||||
.tile {
|
||||
float: left;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
@import "./config";
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 4vw;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
input {
|
||||
all: unset;
|
||||
background-color: white;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
|
||||
select {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
@media (min-width: 1000px) {
|
||||
|
||||
body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
@import "./config";
|
||||
|
||||
.tileContainer {
|
||||
padding: @halfSpace;
|
||||
|
||||
.tile {
|
||||
width: 100%;
|
||||
padding: @halfSpace;
|
||||
|
||||
.tileInner {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: @space;
|
||||
background-color: #fbfbfb;
|
||||
|
||||
.tileTitle {
|
||||
font-weight: bold;
|
||||
padding: @halfSpace @space;
|
||||
background-color: lightskyblue;
|
||||
}
|
||||
|
||||
.tileContent {
|
||||
padding: @halfSpace;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
border: 0.2em solid white;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.tileFooter {
|
||||
padding: @halfSpace @space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 1000px) {
|
||||
|
||||
body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.tileContainer {
|
||||
|
||||
.tile {
|
||||
float: left;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
@import "./config";
|
||||
|
||||
.userHasPassword {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.userNoPassword {
|
||||
color: indianred;
|
||||
}
|
||||
18
src/main/angular/src/user.less
Normal file
18
src/main/angular/src/user.less
Normal file
@ -0,0 +1,18 @@
|
||||
@import "./config.less";
|
||||
|
||||
.user {
|
||||
float: left;
|
||||
padding: @halfSpace;
|
||||
background-color: lightskyblue;
|
||||
border-radius: @halfSpace;
|
||||
margin-right: @halfSpace;
|
||||
margin-bottom: @halfSpace;
|
||||
}
|
||||
|
||||
.user_owner {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.user:hover {
|
||||
background-color: dodgerblue;
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package de.ph87.tools.common;
|
||||
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class EmailHelper {
|
||||
|
||||
private static final Pattern REGEX = Pattern.compile("(?<username>(?<usernameFirst>[^@])[^@]*)@(?<domain>(?<domainFirst>[^.]).*(?<tld>\\.[^.]+))");
|
||||
|
||||
public static boolean isEmailValid(@NonNull final String email) {
|
||||
return REGEX.matcher(email).matches();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String obfuscateEmail(@NonNull final String email) {
|
||||
final Matcher matcher = REGEX.matcher(email);
|
||||
if (!matcher.find()) {
|
||||
return "";
|
||||
}
|
||||
final String usernameFirst = matcher.group("usernameFirst");
|
||||
final String domainFirst = matcher.group("domainFirst");
|
||||
final String tld = matcher.group("tld");
|
||||
return "%s...@%s...%s".formatted(usernameFirst, domainFirst, tld);
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,12 +72,6 @@ public class User extends UserPublicAbstract {
|
||||
@Column(nullable = false)
|
||||
private String password = "";
|
||||
|
||||
@Setter
|
||||
@NonNull
|
||||
@ToString.Exclude
|
||||
@Column(nullable = false)
|
||||
private String email = "";
|
||||
|
||||
public User(@NonNull final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ -49,12 +49,6 @@ public class UserController {
|
||||
return userService.changePassword(userUuid, password);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@PostMapping("changeEmail")
|
||||
public UserPrivateDto changeEmail(@NonNull final UserPrivateUuid userUuid, @NonNull @RequestBody final String email) {
|
||||
return userService.changeEmail(userUuid, email);
|
||||
}
|
||||
|
||||
@GetMapping("delete")
|
||||
public void delete(@NonNull final UserPrivateUuid userUuid, @NonNull final HttpServletResponse response) {
|
||||
userService.delete(userUuid, response);
|
||||
|
||||
@ -12,8 +12,6 @@ import lombok.ToString;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
import static de.ph87.tools.common.EmailHelper.obfuscateEmail;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public class UserPrivateDto extends UserPublicAbstract {
|
||||
@ -37,8 +35,6 @@ public class UserPrivateDto extends UserPublicAbstract {
|
||||
|
||||
private final boolean password;
|
||||
|
||||
private final String email;
|
||||
|
||||
private final boolean admin;
|
||||
|
||||
public UserPrivateDto(@NonNull final User user) {
|
||||
@ -47,7 +43,6 @@ public class UserPrivateDto extends UserPublicAbstract {
|
||||
this.name = user.getName();
|
||||
this.created = user.getCreated();
|
||||
this.password = !user.getPassword().isEmpty();
|
||||
this.email = obfuscateEmail(user.getEmail());
|
||||
this.admin = user.isAdmin();
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static de.ph87.tools.common.EmailHelper.isEmailValid;
|
||||
import static de.ph87.tools.user.uuid.UserPrivateUuidArgumentResolver.USER_UUID_COOKIE_NAME;
|
||||
|
||||
@Slf4j
|
||||
@ -132,18 +131,6 @@ public class UserService {
|
||||
});
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public UserPrivateDto changeEmail(@NonNull final UserPrivateUuid privateUuid, @NonNull final String email) {
|
||||
return modify(privateUuid, user -> {
|
||||
if (!isEmailValid(email)) {
|
||||
log.warn("Cannot change User email: not valid, user={}", user);
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
user.setEmail(email);
|
||||
log.info("User email changed: user={}", user);
|
||||
});
|
||||
}
|
||||
|
||||
public void delete(@NonNull final UserPrivateUuid privateUuid, @NonNull final HttpServletResponse response) {
|
||||
final User user = userRepository.findByPrivateUuid(privateUuid.uuid).orElseThrow(() -> new ResponseStatusException(HttpStatus.BAD_REQUEST));
|
||||
deleteUnchecked(response, user);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user