Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11d5516

Browse files
committed
fix: react app
1 parent 9a52699 commit 11d5516

File tree

11 files changed

+23
-10
lines changed

11 files changed

+23
-10
lines changed

‎.docker/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ DB_MAX_CONNECTIONS=5
2121

2222
# security
2323
TOKEN_SECRET=secret
24+
HASHIDS_SECRET=secret
25+
COOKIE_SECRET=secret
2426
TOKEN_EXPIRATION_IN_HOURS=24
2527
REFRESH_TOKEN_EXPIRATION_IN_DAYS=7
2628
MINUTES_TO_EXPIRE_RECOVERY_CODE=20

‎.docker/docker-compose.dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ services:
5353

5454
# security
5555
TOKEN_SECRET: ${TOKEN_SECRET}
56+
HASHIDS_SECRET: ${HASHIDS_SECRET}
57+
COOKIE_SECRET: ${COOKIE_SECRET}
5658
TOKEN_EXPIRATION_IN_HOURS: ${TOKEN_EXPIRATION_IN_HOURS}
5759
REFRESH_TOKEN_EXPIRATION_IN_DAYS: ${REFRESH_TOKEN_EXPIRATION_IN_DAYS}
5860
MINUTES_TO_EXPIRE_RECOVERY_CODE: ${MINUTES_TO_EXPIRE_RECOVERY_CODE}

‎.docker/docker-compose.prod.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ services:
4444

4545
# security
4646
TOKEN_SECRET: ${TOKEN_SECRET}
47+
HASHIDS_SECRET: ${HASHIDS_SECRET}
48+
COOKIE_SECRET: ${COOKIE_SECRET}
4749
TOKEN_EXPIRATION_IN_HOURS: ${TOKEN_EXPIRATION_IN_HOURS}
4850
REFRESH_TOKEN_EXPIRATION_IN_DAYS: ${REFRESH_TOKEN_EXPIRATION_IN_DAYS}
4951
MINUTES_TO_EXPIRE_RECOVERY_CODE: ${MINUTES_TO_EXPIRE_RECOVERY_CODE}

‎api/src/main/java/com/github/throyer/example/modules/authentication/dtos/CreateAuthenticationWithEmailAndPassword.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CreateAuthenticationWithEmailAndPassword {
1515
@Email(message = "email invalido")
1616
private String email;
1717

18-
@Schema(example = "jubileu123456", required = true)
18+
@Schema(example = "veryStrongAndSecurePassword", required = true)
1919
@NotBlank(message = "o campo password é obrigatório")
2020
private String password;
2121
}

‎api/src/main/java/com/github/throyer/example/modules/recoveries/models/RecoveryUpdate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class RecoveryUpdate {
2222
@NotEmpty(message = "{recovery.code.not-empty}")
2323
private String code;
2424

25-
@Schema(example = "veryStrongPassword123456")
25+
@Schema(example = "veryStrongAndSecurePassword")
2626
@NotEmpty(message = "{user.password.not-empty}")
2727
@Size(min = 8, max = 155, message = "{user.password.size}")
2828
private String password;

‎api/src/main/java/com/github/throyer/example/modules/users/dtos/CreateUserProps.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@
1313
import com.github.throyer.example.modules.mail.models.Addressable;
1414
import com.github.throyer.example.modules.users.entities.User;
1515

16+
import io.swagger.v3.oas.annotations.media.Schema;
1617
import lombok.Data;
1718
import lombok.NoArgsConstructor;
1819

1920
@Data
2021
@NoArgsConstructor
2122
public class CreateUserProps implements Addressable {
2223

24+
@Schema(example = "Jubileu da silva")
2325
@NotEmpty(message = "${user.name.not-empty}")
2426
private String name;
25-
27+
28+
@Schema(example = "jubileu@email.com")
2629
@NotEmpty(message = "{user.email.not-empty}")
2730
@Email(message = "{user.email.is-valid}")
2831
private String email;
29-
32+
33+
@Schema(example = "veryStrongAndSecurePassword")
3034
@NotEmpty(message = "{user.password.not-empty}")
3135
@Size(min = 8, max = 155, message = "{user.password.size}")
3236
private String password;

‎api/src/main/java/com/github/throyer/example/modules/users/dtos/UpdateUserProps.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55

66
import com.github.throyer.example.modules.mail.models.Addressable;
77

8+
import io.swagger.v3.oas.annotations.media.Schema;
9+
810
public class UpdateUserProps implements Addressable {
911

12+
@Schema(example = "Jubileu da Silva Sauro")
1013
@NotEmpty(message = "{user.name.not-empty}")
1114
private String name;
12-
15+
16+
@Schema(example = "jubileu.sauro@email.com")
1317
@NotEmpty(message = "{user.email.not-empty}")
1418
@Email(message = "{user.email.is-valid}")
1519
private String email;

‎api/src/main/java/com/github/throyer/example/modules/users/dtos/UserInformation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class UserInformation {
2323
@Schema(example = "true", required = true)
2424
private Boolean active;
2525

26-
@Schema(example = "[\"MNGR\"]", required = true)
26+
@Schema(example = "[\"ADM\"]", required = true)
2727
private final List<String> roles;
2828

2929
public UserInformation(User user) {

‎web/src/hooks/use-authentication/use-authentication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const useAuthentication = () => {
1313

1414
const login = useCallback(async ({ email, password }: Credentials, redirectTo = '/home'): Promise<LoginResult> => {
1515
try {
16-
const { data } = await api.post<SessionsApiResponse>('sessions', { email, password });
16+
const { data } = await api.post<SessionsApiResponse>('v1/authentication', { email, password });
1717
const { user, ...session } = data;
1818

1919
setSession(session);

‎web/src/http/api.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ api.interceptors.request.use(async (configs) => {
1414
const { session, set: setSession } = useSession.getState()
1515

1616
if (session) {
17-
1817
if (session.isExpired()) {
1918
try {
20-
const { data: sessionResponse } = await axios.post(`${ENV.BASE_URL}/sessions/refresh`, {
19+
const { data: sessionResponse } = await axios.post(`${ENV.BASE_URL}/v1/authentication/refresh`, {
2120
refreshToken: session.refreshToken
2221
});
2322
setSession(sessionResponse);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /