Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Development #1

wants to merge 25 commits into from

Conversation

kazi-sahabuddin
Copy link
Owner

No description provided.

user.setRole("ROLE_USER");
user.setEnabled(true);
user.setImageUrl("default.png");
User saved = userRepository.save(user);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write a function in UserService to register user. Call this function from this controller.

@meheedihasaan meheedihasaan self-requested a review December 13, 2024 17:05
@@ -15,11 +17,17 @@ public class User {
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

@NotBlank(message = "Name is required")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bhai, it will be better if you use a SignUp request and apply these validation annotation there.

private String name;

@NotBlank(message = "Email is required")
@Size(max = 100)
@Column(unique = true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use @Email annotation to validate the email.

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

User user = userRepository.findByEmail(username);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Email can be case-insensitive. So, it is better to use findByEmail with ignore case.

@@ -25,7 +25,7 @@
<a class="nav-link" th:href="@{/about}">About</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/login}">Login</a>
<a class="nav-link" th:href="@{/sign-in}" >Sing In</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/signup}">Signup</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct this as /sign-up

@@ -35,8 +42,17 @@ public String userDashboard(Model model) {
}

@GetMapping(value = "/add-contact")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a ContactController and then write all the contact related operation inside the controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants