Index: src/main/java/com/db/finki/www/build_board/config/WebSecurityConfig.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/config/WebSecurityConfig.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/config/WebSecurityConfig.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -43,5 +43,7 @@
                                         "/about",
                                     "/project_imgs/buildboard-logo.jpg",
-                                    "static/**"
+                                "*.jpg",
+                                "*.png",
+                                "/register"
                                 ).permitAll()
                                 .requestMatchers(
Index: src/main/java/com/db/finki/www/build_board/controller/home_pages/HomePageController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/home_pages/HomePageController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/home_pages/HomePageController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,9 +1,13 @@
 package com.db.finki.www.build_board.controller.home_pages;
 
+import com.db.finki.www.build_board.entity.user_types.BBUser;
+import com.db.finki.www.build_board.service.BBUserDetailsService;
 import com.db.finki.www.build_board.service.search.SearchService;
 import com.db.finki.www.build_board.service.threads.itfs.TagService;
+import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
@@ -15,8 +19,10 @@
     private final SearchService searchService;
     private final TagService tagService;
+    private final BBUserDetailsService bbUserDetailsService;
 
-    public HomePageController(SearchService searchService, TagService tagService ) {
+    public HomePageController(SearchService searchService, TagService tagService, BBUserDetailsService bbUserDetailsService) {
         this.searchService = searchService;
         this.tagService = tagService;
+        this.bbUserDetailsService = bbUserDetailsService;
     }
 
@@ -40,3 +46,29 @@
     }
 
+    @GetMapping("/register")
+    public String getRegisterPage(Model model){
+        model.addAttribute("user", new BBUser());
+        model.addAttribute("canEdit",true);
+        return "home_pages/register";
+    }
+
+    @PostMapping("/register")
+    public String registerPost(
+            @RequestParam String username,
+            @RequestParam String email,
+            @RequestParam String name,
+            @RequestParam String password,
+            @RequestParam String description,
+            @RequestParam String sex
+    ) {
+        bbUserDetailsService.createUser(
+                username,
+                email,
+                name,
+                password,
+                description,
+                sex
+        );
+        return "redirect:/login";
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/controller/home_pages/UserProfileController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/home_pages/UserProfileController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/home_pages/UserProfileController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -4,4 +4,6 @@
 import com.db.finki.www.build_board.service.BBUserDetailsService;
 import com.db.finki.www.build_board.service.threads.impl.FileUploadService;
+import jakarta.servlet.http.HttpSession;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -33,6 +35,13 @@
         }
     }
+
+    @PreAuthorize("requestedByUsername==username")
     @PostMapping("/upload-avatar")
-    public String uploadAvatar(Model model, @PathVariable String username, @RequestParam MultipartFile userImage, RedirectAttributes redirectAttributes) {
+    public String uploadAvatar(Model model,
+                               @PathVariable String username,
+                               @RequestParam MultipartFile userImage,
+                               RedirectAttributes redirectAttributes,
+                               @RequestParam(name = "cur_user_username") String requestedByUsername
+    ) {
         BBUser u = (BBUser) userService.loadUserByUsername(username);
         try{
@@ -44,5 +53,29 @@
         }
 
-        return "redirect:/" + username + "home_pages/profile";
+        return "redirect:/" + username + "/profile";
+    }
+
+    @PreAuthorize("requestedByUsername==oldUsername")
+    @PostMapping("/profile/change")
+    public String changeInfo(
+            @RequestParam String email,
+            @RequestParam String name,
+            @RequestParam String description,
+            @PathVariable(name = "username") String oldUsername,
+            @RequestParam(name = "username") String newUsername,
+            @RequestParam(name = "cur_user_username") String requestedByUsername,
+            @RequestParam String password,
+            HttpSession session
+    ){
+        BBUser user = userService.changeInfoForUserWithUsername(
+                oldUsername,
+                newUsername,
+                email,
+                name,
+                description,
+                password
+        );
+        session.setAttribute("user", user);
+        return "redirect:/";
     }
 }
Index: src/main/java/com/db/finki/www/build_board/controller/thread_controllers/DiscussionController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/thread_controllers/DiscussionController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/thread_controllers/DiscussionController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -4,4 +4,5 @@
 import com.db.finki.www.build_board.service.threads.impl.DiscussionService;
 import jakarta.servlet.http.HttpSession;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -18,5 +19,5 @@
     }
 
-    @PostMapping("/{topic-name}/reply/add")
+    @PostMapping("/topic/{topic-name}/reply/add")
     public String addReply(@PathVariable(name = "topic-name") String topicName, @RequestParam int parentId, @RequestParam String content, Model model, HttpSession session) {
 
@@ -31,12 +32,15 @@
     }
 
-    @PostMapping("/{topic-name}/reply/edit")
-    public String editReply(@PathVariable(name = "topic-name") String topicName, @RequestParam int replyId, @RequestParam String content, Model model, HttpSession session) {
+    @PreAuthorize("@discussionService.findDiscussionById(replyId).user.username==username")
+    @PostMapping("/topic/{topic-name}/reply/edit")
+    public String editReply(@PathVariable(name = "topic-name") String topicName, @RequestParam int replyId, @RequestParam String content, Model model, HttpSession session
+    ,String username) {
         discussionService.edit(replyId, content);
         return "redirect:/topic/" + topicName;
     }
 
-    @PostMapping("/{topic-name}/discussion/delete")
-    public String deleteDiscussion(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session) {
+    @PreAuthorize("@discussionService.findDiscussionById(threadId).user.username==username")
+    @PostMapping("/topic/{topic-name}/discussion/delete")
+    public String deleteDiscussion(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session, @RequestParam String username) {
         BBUser user = (BBUser) session.getAttribute("user");
         discussionService.delete(threadId);
Index: src/main/java/com/db/finki/www/build_board/controller/thread_controllers/ProjectController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/thread_controllers/ProjectController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/thread_controllers/ProjectController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -7,4 +7,5 @@
 import com.db.finki.www.build_board.service.threads.itfs.TagService;
 import org.hibernate.Hibernate;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -24,7 +25,5 @@
 
     @GetMapping("/{title}")
-    public String getProjectPage(@PathVariable String title, Model model) {
-        Project project = projectService.findByTitle(title);
-
+    public String getProjectPage(@PathVariable(name = "title") Project project, Model model) {
         model.addAttribute("project", project);
         model.addAttribute("tags", topicService.findAll());
@@ -53,19 +52,21 @@
     @GetMapping("/{pr_title}/modify")
     public String getModifyPage(
-            @PathVariable(name = "pr_title") String title,
+            @PathVariable(name = "pr_title") Project project,
             Model model
     ) {
-        model.addAttribute("project", projectService.findByTitle(title));
+        model.addAttribute("project", project);
         return "project_pages/project-create";
     }
 
+    @PreAuthorize("project.getUser().username.equals(username)")
     @PostMapping("/{title}/modify")
     public String modifyProject(
-            @PathVariable String title,
+            @PathVariable(name = "title") Project project,
             @RequestParam(name = "title") String newTitle,
             @RequestParam(name = "repo_url") String repoUrl,
+            @RequestParam String username,
             @RequestParam String description
     ){
-        return "redirect:/project/" +  projectService.updateProject(title,repoUrl,description,newTitle).getTitle();
+        return "redirect:/project/" +  projectService.updateProject(project,repoUrl,description,newTitle).getTitle();
     }
 
@@ -81,18 +82,23 @@
     }
 
+    @PreAuthorize("project.getUser().username.equals(username)")
     @PostMapping("/topic/add")
     public String addTopic(
-            @RequestParam(name = "project_title") String projectTitle,
+            @RequestParam(name = "project_title") Project project,
             @RequestParam(name = "title") String topicsTitle,
             @RequestParam String description,
-            @SessionAttribute BBUser user
+            @RequestParam String username
     ){
-        projectService.addToProjectWithIdNewTopic(projectTitle, topicsTitle,description,user);
-        return "redirect:/project/" + projectTitle;
+        projectService.addToProjecNewTopic(project, topicsTitle,description,username);
+        return "redirect:/project/" + project.getTitle();
     }
 
+    @PreAuthorize("project.getUser().username.equals(username)")
     @PostMapping("/delete/*")
-    public String delete(@RequestParam Long id) {
-        projectService.deleteById(id);
+    public String delete(
+            @RequestParam(name = "id") Project project,
+            @RequestParam String username
+    ) {
+        projectService.delete(project);
         return "redirect:/" ;
     }
Index: src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TagController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TagController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TagController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,4 +1,5 @@
 package com.db.finki.www.build_board.controller.thread_controllers;
 
+import com.db.finki.www.build_board.entity.threads.Project;
 import com.db.finki.www.build_board.entity.threads.Topic;
 import com.db.finki.www.build_board.service.threads.impl.ProjectService;
@@ -6,4 +7,5 @@
 import com.db.finki.www.build_board.service.threads.itfs.TopicService;
 import jakarta.servlet.http.HttpSession;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -24,8 +26,10 @@
     }
 
+    @PreAuthorize("@topicServiceImpl.getById(id).user.username==username")
     @PostMapping("/topic/add-tag/{id}")
     public String addTagToTopic(@PathVariable(name = "id") long id,
                          @RequestParam String tagName,
                          HttpSession session,
+                         String username,
                          Model model) {
         Topic t = topicService.getById(id);
@@ -36,6 +40,7 @@
     }
 
+    @PreAuthorize("@topicServiceImpl.getById(topicId).user.username==username")
     @PostMapping("/topic/delete-tag/{topicId}/{tagName}")
-    public String deleteTagTopic(@PathVariable long topicId, @PathVariable String tagName, Model model) {
+    public String deleteTagTopic(@PathVariable long topicId, @PathVariable String tagName, Model model, @RequestParam String username) {
         Topic t = topicService.deleteTagFromTopic(topicId, tagName);
         model.addAttribute("topic", t);
@@ -44,21 +49,25 @@
     }
 
+    @PreAuthorize("project.getUser().username==username")
     @PostMapping("/project/{title}/add-tag")
     public String addTagToProject(
-            @PathVariable String title,
-            @RequestParam(name = "tagName") String tagName
+            @PathVariable(name="title") Project project,
+            @RequestParam(name = "tagName") String tagName,
+            @RequestParam String username
     )
     {
-        projectService.addTagToProjectWithTitle(title,tagName);
-        return "redirect:/project/" + title;
+        projectService.addTagToProject(project,tagName);
+        return "redirect:/project/" + project.getTitle();
     }
 
+    @PreAuthorize("project.getUser().getUsername().equals(username)")
     @PostMapping("/project/delete-tag/{projectTitle}/{tagName}")
     public String deleteTagProject(
-            @PathVariable String projectTitle,
-            @PathVariable String tagName
+            @PathVariable(name = "projectTitle") Project project,
+            @PathVariable String tagName,
+            @RequestParam String username
     ){
-        projectService.removeTagFromProjectWithTitle(projectTitle,tagName);
-        return "redirect:/project/" + projectTitle;
+        projectService.removeTagFromProject(project,tagName);
+        return "redirect:/project/" + project.getTitle();
     }
 }
Index: src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TopicController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TopicController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/thread_controllers/TopicController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -14,5 +14,4 @@
 
 
-//TODO: security na metodi spored to dali e baranjeto od userot
 @Controller
 @RequestMapping("/topic")
@@ -52,14 +51,14 @@
     }
 
-//    @PreAuthorize("")
+    @PreAuthorize("@topicServiceImpl.getById(id).user.username==username")
     @PostMapping("/delete/{id}")
-    public String deleteTopic(@PathVariable(name = "id") long id, HttpSession session) {
+    public String deleteTopic(@PathVariable(name = "id") long id, HttpSession session, @RequestParam String username) {
         topicService.deleteTopicById(id);
         return "redirect:/";
     }
 
-
+    @PreAuthorize("@topicServiceImpl.getById(id).user.username==username")
     @PostMapping("/edit/{id}")
-    public String editTopic(@PathVariable long id, @RequestParam String title, @RequestParam String content, Model model) {
+    public String editTopic(@PathVariable long id, @RequestParam String title, @RequestParam String content, Model model, @RequestParam String username) {
         Topic t = topicService.save(id, title, content);
         model.addAttribute("topic", t);
Index: src/main/java/com/db/finki/www/build_board/controller/utils/LikesController.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/controller/utils/LikesController.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/controller/utils/LikesController.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -17,20 +17,31 @@
     }
 
-    @PostMapping("/{topic-name}/discussion/dislike")
-    public String dislike(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session) {
+    private void rate(int threadId, HttpSession session, boolean likes) {
+        BBUser user = (BBUser) session.getAttribute("user");
+        threadService.rate(threadId,user.getId(),likes );
+    }
 
-        BBUser user = (BBUser) session.getAttribute("user");
-        threadService.rate(threadId,user.getId(),false);
-
+    @PostMapping("/topic/{topic-name}/discussion/dislike")
+    public String dislikeTopic(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session) {
+        rate(threadId,session,false);
         return "redirect:/topic/" + topicName;
     }
 
-    @PostMapping("/{topic-name}/discussion/like")
-    public String like(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session) {
-
-        BBUser user = (BBUser) session.getAttribute("user");
-        threadService.rate(threadId,user.getId(),true);
-
+    @PostMapping("/topic/{topic-name}/discussion/like")
+    public String likeTopic(@PathVariable(name = "topic-name") String topicName, @RequestParam int threadId, HttpSession session) {
+        rate(threadId, session, true);
         return "redirect:/topic/" + topicName;
     }
+
+    @PostMapping("/project/{thread-name}/discussion/like")
+    public String likeProject(@PathVariable(name = "thread-name") String projectName, @RequestParam int threadId, HttpSession session) {
+        rate(threadId,session,true);
+        return "redirect:/project/" + projectName;
+    }
+
+    @PostMapping("/project/{thread-name}/discussion/dislike")
+    public String dislikeProject(@PathVariable(name = "thread-name") String threadName, @RequestParam int threadId, HttpSession session) {
+        rate(threadId,session,false);
+        return "redirect:/project/" + threadName;
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/converters/ProjectConverter.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/converters/ProjectConverter.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
+++ src/main/java/com/db/finki/www/build_board/converters/ProjectConverter.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -0,0 +1,30 @@
+package com.db.finki.www.build_board.converters;
+
+import com.db.finki.www.build_board.entity.threads.Project;
+import com.db.finki.www.build_board.service.threads.impl.ProjectService;
+import lombok.NonNull;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ProjectConverter implements Converter<String, Project> {
+
+    private final ProjectService projectService;
+    private final String REGEX_TO_CHECK_IF_ITS_A_NUMBER="^[0-9]+$";
+
+    public ProjectConverter(ProjectService projectService) {
+        this.projectService = projectService;
+    }
+
+    @Override
+    public Project convert(@NonNull String something) {
+        if(something.matches(REGEX_TO_CHECK_IF_ITS_A_NUMBER)) {
+            Long id = Long.parseLong(something);
+            return projectService.findById(id);
+        }else{
+            String title = something;
+            return projectService.findByTitle(title);
+        }
+    }
+
+}
Index: src/main/java/com/db/finki/www/build_board/entity/threads/BBThread.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/threads/BBThread.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/entity/threads/BBThread.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -18,5 +18,6 @@
 public class BBThread {
     @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "thread_gen")
+    @SequenceGenerator(name = "thread_gen", sequenceName = "thread_id_seq", allocationSize = 1)
     protected Integer id;
 
Index: src/main/java/com/db/finki/www/build_board/entity/threads/Project.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/threads/Project.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/entity/threads/Project.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -10,5 +10,4 @@
 
 //TODO: project request
-//TODO: implement likes method for project
 //TODO: crud na kanali
 @Data
@@ -31,10 +30,5 @@
     }
 
-    @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE})
-    @JoinTable(
-            name = "topic_belongs_to_project",
-            joinColumns = @JoinColumn(name = "project_id", referencedColumnName = "id"),
-            inverseJoinColumns = @JoinColumn(name = "topic_id")
-    )
+    @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE}, mappedBy = "parent")
     private List<Topic> topics = new ArrayList<>();
 
Index: src/main/java/com/db/finki/www/build_board/entity/threads/Topic.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/threads/Topic.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/entity/threads/Topic.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -24,5 +24,5 @@
     @ManyToOne
     @JoinColumn(name = "parent_id")
-    private Topic parent;
+    private BBThread parent;
 
     @Override
Index: src/main/java/com/db/finki/www/build_board/entity/threads/multi_valued_attributes/Guideline.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/threads/multi_valued_attributes/Guideline.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/entity/threads/multi_valued_attributes/Guideline.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -14,5 +14,6 @@
 public class Guideline {
     @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "guideline_gen")
+    @SequenceGenerator(name = "guideline_gen", sequenceName = "topic_guidelines_id_seq",  allocationSize = 1)
     private Integer id;
 
Index: src/main/java/com/db/finki/www/build_board/entity/user_types/BBUser.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/entity/user_types/BBUser.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/entity/user_types/BBUser.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -32,6 +32,8 @@
 
     @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_gen")
+    @SequenceGenerator(name = "user_gen", sequenceName = "users_id_seq", allocationSize = 1)
     private int id;
+
     private String username;
     private String password;
@@ -69,4 +71,5 @@
     }
 
+
     @Override
     public boolean equals(Object other){
@@ -82,3 +85,15 @@
         return Objects.hashCode(id);
     }
+
+    public BBUser(
+            String username, String email, String name, String password, String description, String sex
+    ){
+        this.username = username;
+        this.email = email;
+        this.name = name;
+        this.password = password;
+        this.description = description;
+        this.sex=sex;
+        this.isEnabled=true;
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/service/BBUserDetailsService.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/BBUserDetailsService.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/service/BBUserDetailsService.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,8 +1,11 @@
 package com.db.finki.www.build_board.service;
 
+import com.db.finki.www.build_board.entity.user_types.BBUser;
 import com.db.finki.www.build_board.repository.UserRepository;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 
@@ -10,7 +13,9 @@
 public class BBUserDetailsService implements UserDetailsService {
     private final UserRepository userRepository;
+    private final PasswordEncoder passwordEncoder;
 
-    public BBUserDetailsService(UserRepository userRepository) {
+    public BBUserDetailsService(UserRepository userRepository, PasswordEncoder passwordEncoder) {
         this.userRepository = userRepository;
+        this.passwordEncoder = passwordEncoder;
     }
 
@@ -19,3 +24,35 @@
         return userRepository.findByUsername(username).orElseThrow(() -> new UsernameNotFoundException("User not found with username: " + username));
     }
+
+    public BBUser changeInfoForUserWithUsername(String oldUsername, String newUsername, String email, String name, String description, String password) {
+        BBUser user = (BBUser) loadUserByUsername(oldUsername);
+
+        user.setUsername(newUsername);
+        user.setEmail(email);
+        user.setName(name);
+        user.setDescription(description);
+
+        if (!password.isBlank() && !password.isEmpty()) {
+            user.setPassword(
+                    passwordEncoder.encode(password)
+            );
+        }
+
+        return userRepository.save(user);
+    }
+
+    public BBUser createUser(String username, String email, String name, String password, String description, String sex) {
+        password = passwordEncoder.encode(password);
+        sex = sex.equals("male") ? "m" : "f";
+        return userRepository.save(
+                new BBUser(
+                        username,
+                        email,
+                        name,
+                        password,
+                        description,
+                        sex
+                )
+        );
+    }
 }
Index: src/main/java/com/db/finki/www/build_board/service/search/SearchServiceImpl.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/search/SearchServiceImpl.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/service/search/SearchServiceImpl.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -34,5 +34,4 @@
 
     //todo strictmode so and spec
-    // todo: vidi dali ko ke ne e asociran tag da go trgnime
 
     private List<Topic> searchTopics(String query, List<String> filters) {
Index: src/main/java/com/db/finki/www/build_board/service/threads/impl/ProjectService.java
===================================================================
--- src/main/java/com/db/finki/www/build_board/service/threads/impl/ProjectService.java	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/java/com/db/finki/www/build_board/service/threads/impl/ProjectService.java	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -3,8 +3,11 @@
 import java.util.List;
 
+import com.db.finki.www.build_board.entity.threads.BBThread;
 import com.db.finki.www.build_board.entity.threads.Tag;
+import com.db.finki.www.build_board.entity.threads.Topic;
 import com.db.finki.www.build_board.entity.user_types.BBUser;
 import com.db.finki.www.build_board.entity.threads.Project;
 import com.db.finki.www.build_board.repository.threads.ProjectRepository;
+import com.db.finki.www.build_board.service.BBUserDetailsService;
 import com.db.finki.www.build_board.service.threads.itfs.TagService;
 import com.db.finki.www.build_board.service.threads.itfs.TopicService;
@@ -16,9 +19,11 @@
     private final TopicService topicService;
     private final TagService tagService;
+    private final BBUserDetailsService userDetailsService;
 
-    public ProjectService(ProjectRepository projectRepository, TopicServiceImpl topicService, TagServiceImpl tagService) {
+    public ProjectService(ProjectRepository projectRepository, TopicServiceImpl topicService, TagServiceImpl tagService, BBUserDetailsService userDetailsService) {
         this.projectRepository = projectRepository;
         this.topicService = topicService;
         this.tagService = tagService;
+        this.userDetailsService = userDetailsService;
     }
 
@@ -37,18 +42,13 @@
     }
 
-    public void addToProjectWithIdNewTopic(String projectTitle, String title, String description, BBUser user) {
-        Project project = findByTitle(projectTitle);
-        project.getTopics().add(
-                topicService.create(title, description, user)
-        );
+    public void addToProjecNewTopic(Project project, String title, String description, String username) {
+        BBUser user = ((BBUser) userDetailsService.loadUserByUsername(username));
+        Topic topic = topicService.create(title, description, user);
+        topic.setParent(project);
+        project.getTopics().add(topic);
         projectRepository.save(project);
     }
 
-    public void deleteById(Long id) {
-        projectRepository.deleteById(id);
-    }
-
-    public void addTagToProjectWithTitle(String title, String tagName) {
-        Project project = findByTitle(title);
+    public void addTagToProject(Project project, String tagName) {
         Tag tag = null ;
         try{
@@ -61,6 +61,5 @@
     }
 
-    public Project updateProject(String projectTitle, String repoUrl, String description, String newTitle) {
-        Project project = findByTitle(projectTitle);
+    public Project updateProject(Project project, String repoUrl, String description, String newTitle) {
         project.setRepoUrl(repoUrl);
         project.setDescription(description);
@@ -69,6 +68,13 @@
     }
 
-    public void removeTagFromProjectWithTitle(String projectTitle, String tagName) {
-        final Project project = findByTitle(projectTitle);
+    public Project findById(Long id) {
+        return projectRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("Project not found"));
+    }
+
+    public void delete(Project project) {
+        projectRepository.delete(project);
+    }
+
+    public void removeTagFromProject(Project project, String tagName) {
         project.getTags().remove(tagService.findByName(tagName));
         projectRepository.save(project);
Index: src/main/resources/db/migration/V1__init_ddl.sql
===================================================================
--- src/main/resources/db/migration/V1__init_ddl.sql	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/db/migration/V1__init_ddl.sql	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -47,10 +47,10 @@
     id            SERIAL PRIMARY KEY,
     username      VARCHAR(32) UNIQUE NOT NULL,
-    email varchar(60) not null,
-    name varchar(32) not null,
-    is_activate   bool,
+    email         varchar(60)        not null,
+    name          varchar(32)        not null,
+    is_activate   bool DEFAULT true,
     password      VARCHAR(72),
     description   VARCHAR(200),
-    registered_at TIMESTAMP,
+    registered_at TIMESTAMP DEFAULT NOW(),
     sex           VARCHAR(1)
 );
@@ -76,5 +76,5 @@
 (
     title     VARCHAR(256) NOT NULL,
-    parent_id INT REFERENCES thread (id),
+    parent_id INT REFERENCES thread (id) on delete cascade,
     id        INT PRIMARY KEY REFERENCES thread (id) on delete cascade
 );
@@ -99,6 +99,6 @@
 CREATE TABLE likes
 (
-    user_id   INT REFERENCES users (id),
-    thread_id INT REFERENCES thread (id),
+    user_id   INT REFERENCES users (id) on delete cascade ,
+    thread_id INT REFERENCES thread (id) on delete cascade,
     PRIMARY KEY (user_id, thread_id)
 );
@@ -139,7 +139,7 @@
 CREATE TABLE developer_associated_with_project
 (
-    project_id   INT REFERENCES thread (id),
-    developer_id INT REFERENCES users (id),
-    started_at   TIMESTAMP,
+    project_id   INT REFERENCES thread (id) on delete cascade,
+    developer_id INT REFERENCES users (id) on delete cascade,
+    started_at   TIMESTAMP DEFAULT NOW(),
     ended_at     TIMESTAMP,
     PRIMARY KEY (project_id, developer_id, started_at)
@@ -158,9 +158,9 @@
 CREATE TABLE users_project_roles
 (
-    user_id    INT REFERENCES users (id),
+    user_id    INT REFERENCES users (id) on delete cascade,
     project_id INT,
     role_name  VARCHAR(32),
     FOREIGN KEY (role_name, project_id)
-        REFERENCES project_roles (name, project_id),
+        REFERENCES project_roles (name, project_id) ON DELETE CASCADE,
     PRIMARY KEY (user_id, project_id, role_name)
 );
@@ -172,5 +172,5 @@
     PRIMARY KEY (permission_name, role_name, project_id),
     FOREIGN KEY (role_name, project_id)
-        REFERENCES project_roles (name, project_id)
+        REFERENCES project_roles (name, project_id) ON DELETE CASCADE
 );
 CREATE TYPE status AS ENUM ('ACCEPTED', 'DENIED', 'PENDING');
@@ -180,6 +180,6 @@
     description VARCHAR(200),
     status      status                     NOT NULL,
-    user_id     INT REFERENCES users (id)  NOT NULL,
-    project_id  INT REFERENCES thread (id) NOT NULL
+    user_id     INT REFERENCES users (id)  ON DELETE CASCADE NOT NULL ,
+    project_id  INT REFERENCES thread (id) ON DELETE CASCADE NOT NULL
 );
 CREATE TABLE report
@@ -264,25 +264,22 @@
 create or replace view v_discussion_thread
 as
-with recursive depth_table as
-(
-    select parent_id, id, 0 as depth
-    from discussion_thread
-    UNION ALL
-    select discuss.parent_id, dpth.id, dpth.depth + 1
-    from depth_table dpth
-    join discussion_thread discuss
-    on dpth.parent_id=discuss.id
-),
-tmp as (
-    select id,max(depth) as depth
-    from depth_table
-    group by id
-)
-select d.id as id ,t.user_id as user_id ,d.depth as depth, d1.parent_id as parent_id
+with recursive
+    depth_table as
+        (select parent_id, id, 0 as depth
+         from discussion_thread
+         UNION ALL
+         select discuss.parent_id, dpth.id, dpth.depth + 1
+         from depth_table dpth
+                  join discussion_thread discuss
+                       on dpth.parent_id = discuss.id),
+    tmp as (select id, max(depth) as depth
+            from depth_table
+            group by id)
+select d.id as id, t.user_id as user_id, d.depth as depth, d1.parent_id as parent_id
 from tmp d
          join depth_table d1
-              on d.id=d1.id and d1.depth=d.depth
+              on d.id = d1.id and d1.depth = d.depth
          join thread t
-              on t.id=d.id;
+              on t.id = d.id;
 -------------------------- FUNCTIONS ----------------------
 CREATE OR REPLACE FUNCTION fn_validate_topic_title()
@@ -304,4 +301,16 @@
 END;
 $$;
+create function check_if_user_exists_in(table_name text, field_name text, field_value text) returns boolean
+    language plpgsql
+as
+$$
+DECLARE
+    result BOOL;
+BEGIN
+    EXECUTE format('SELECT EXISTS (SELECT 1 FROM %I WHERE %I = %L)', table_name, field_name, field_value)
+        INTO result;
+    RETURN result;
+END
+$$;
 CREATE OR REPLACE FUNCTION fn_insert_topics_creator_as_moderator()
     RETURNS TRIGGER
@@ -316,7 +325,9 @@
     FROM v_topic_thread
     WHERE v_topic_thread.id = new.id;
-    INSERT INTO topic_threads_moderators(thread_id, user_id) VALUES (new.id, v_user_id);
+    IF not check_if_user_exists_in('moderator', 'id', v_user_id::text) THEN
+        INSERT INTO topic_threads_moderators(thread_id, user_id) VALUES (new.id, v_user_id);
+    END IF;
     RETURN NEW;
-END;
+END
 $$;
 
@@ -327,12 +338,81 @@
 $$
 DECLARE
-    usrId INT;
+    usrId      INT;
+    new_project_id INT;
 BEGIN
-    SELECT user_id INTO usrId FROM v_project_thread p WHERE NEW.id = p.id;
-    INSERT INTO developer VALUES (usrId);
-    INSERT INTO project_manager VALUES (usrId);
+    SELECT user_id, id
+    into usrId,new_project_id
+    FROM v_project_thread p
+    WHERE NEW.id = p.id;
+    IF not check_if_user_exists_in('developer', 'id', usrId::text) THEN
+        INSERT INTO developer VALUES (usrId);
+        IF NOT EXISTS (
+            select 1
+            from developer_associated_with_project dp
+            where dp.project_id=new_project_id and dp.developer_id=usrId
+        )
+        THEN
+            INSERT INTO developer_associated_with_project(project_id, developer_id, started_at)
+            values (new_project_id, usrId, NOW());
+        END IF;
+    end if;
+    IF not check_if_user_exists_in('project_manager', 'id', usrId::text) THEN
+        INSERT INTO project_manager VALUES (usrId);
+    end if;
     RETURN NEW;
-END;
-$$;
+END
+$$;
+create or replace function fn_remove_unused_tags()
+    returns trigger
+    language plpgsql
+as
+$$
+BEGIN
+    IF not check_if_user_exists_in('tag_threads', 'tag_name', old.tag_name)
+    THEN
+        raise notice 'kakosi';
+        delete from tag t where t.name = old.tag_name;
+    end if;
+    return old;
+end;
+$$;
+create or replace function fn_remove_not_active_project_manager()
+    returns trigger
+    language plpgsql
+as
+$$
+DECLARE
+    creator_id int;
+begin
+    select user_id
+    into creator_id
+    from thread t
+    where t.id = old.id;
+
+    IF NOT EXISTS(select 1
+                  from thread t
+                  where t.id in (select id from project_thread)
+                    and t.user_id = creator_id) THEN
+        delete from project_manager where id = creator_id;
+    end if;
+    return new;
+end
+$$;
+
+create or replace function fn_remove_not_active_developer()
+    returns trigger
+    language plpgsql
+as
+$$
+begin
+    IF not check_if_user_exists_in('developer_associated_with_project','developer_id',old.developer_id::text)
+    THEN
+        delete from developer d
+        where d.id=old.developer_id;
+    end if;
+    return new;
+end
+$$;
+
 -------------------------- TRIGGERS ----------------------
 CREATE OR REPLACE TRIGGER tr_check_topic_name
@@ -352,3 +432,20 @@
 EXECUTE FUNCTION fn_insert_project_manager();
 
----TODO: trigeri za trgnanje na project_owner ako se trgnit project i nekoj takvi dependencies
+create or replace trigger tr_remove_unused_tags
+    after delete
+    on tag_threads
+    for each row
+execute function fn_remove_unused_tags();
+
+create trigger tr_remove_not_project_managers
+    after delete
+    on project_thread
+    for each row
+execute function fn_remove_not_active_project_manager();
+
+create trigger tr_remove_not_active_developer
+    after delete
+    on developer_associated_with_project
+    for each row
+execute function fn_remove_not_active_developer();
+
Index: src/main/resources/db/migration/V2__add_test_data.sql
===================================================================
--- src/main/resources/db/migration/V2__add_test_data.sql	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/db/migration/V2__add_test_data.sql	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -35,6 +35,6 @@
 INSERT INTO topic_thread (id, title, parent_id)
 VALUES
-    (1, 'Topic 1' , NULL),
-    (2, 'Topic 2', NULL),
+    (1, 'Topic 1' , 5),
+    (2, 'Topic 2', 5),
     (8, 'Topic 7' , NULL),
     (9, 'Topic 8', NULL),
@@ -67,8 +67,4 @@
     (4, 6),
     (5, 7);
-INSERT INTO topic_belongs_to_project (topic_id, project_id)
-VALUES
-    (1, 5),
-    (2, 5);
 
 INSERT INTO blacklisted_user (topic_id, user_id, moderator_id, start_date, end_date, reason)
@@ -76,9 +72,4 @@
     (1, 2, 1, NOW(), NOW() + INTERVAL '7 days', 'Spamming'),
     (2, 3, 4, NOW(), NOW() + INTERVAL '3 days', 'Offensive language');
-
-INSERT INTO developer_associated_with_project (project_id, developer_id, started_at)
-VALUES
-    (5, 2, NOW()),
-    (5, 3, NOW());
 
 INSERT INTO permissions (name)
Index: src/main/resources/templates/create-topic.html
===================================================================
--- src/main/resources/templates/create-topic.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/create-topic.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -26,4 +26,5 @@
         <button type="submit" class="btn btn-primary w-100">Submit</button>
         <input th:if="${!#strings.isEmpty(prefix)}" type="hidden" name="project_title" th:value="${project_title}"/>
+        <input type="hidden" name="username" th:value="${session.user.getUsername()}"/>
       </form>
     </div>
Index: src/main/resources/templates/fragments/user_fields.html
===================================================================
--- src/main/resources/templates/fragments/user_fields.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
+++ src/main/resources/templates/fragments/user_fields.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -0,0 +1,35 @@
+<form method="post"
+      class="d-flex gap-2 flex-grow-1 flex-column gap-2 list-group-flush "
+      th:action="${url}"
+      th:fragment="user_fields(url)"
+>
+    <h5>Personal Details</h5>
+    <label class="fw-bold ">Username:
+        <input th:readonly="${!canEdit}"
+               name="username" type="text" th:value="${user.getUsername()}"
+               class="w-100 border border-secondary ps-2 rounded list-group-item">
+    </label>
+    <label class="fw-bold ">Name:
+        <input name="name" th:readonly="${!canEdit}"
+               type="text" th:value="${user.getName()}" class="border ps-2 border-secondary rounded w-100 list-group-item">
+    </label>
+    <label th:readonly="${!canEdit}"
+           class="fw-bold ">Email:
+        <input name="email" type="text" th:value="${user.getEmail()}" class="border ps-2 border-secondary rounded w-100 list-group-item">
+    </label>
+    <label>
+        <span class="fw-bold d-block">Description</span>
+        <textarea name="description" class="border border-secondary ps-2 rounded w-100" th:readonly="${!canEdit}"
+                  th:text="${user.getDescription()}"></textarea>
+    </label>
+    <label th:readonly="${!canEdit}"
+           class="fw-bold ">Password:
+        <input name="password"
+               placeholder="Leave empty if you don't want to change it"
+               type="password" class="w-100 ps-2 list-group-item border border-secondary rounded">
+    </label>
+    <input type="hidden" name="cur_user_username"
+           th:value="${session.user == null} ? '' : ${session.user.getUsername()}">
+    <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Save changes
+    </button>
+</form>
Index: src/main/resources/templates/home_pages/home.html
===================================================================
--- src/main/resources/templates/home_pages/home.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/home_pages/home.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -68,9 +68,12 @@
                 </div>
                 <div class="nav-item d-flex align-items-center ms-xs-5 ms-0  mt-xs-5" th:if="${session.user != null}">
-                    <a href="/logout" class="content-max-width btn btn-outline-primary btn-sm ">Log out</a>
+                    <a href="/logout" class="content-max-width btn btn-outline-primary btn-sm text-nowrap ">Log out</a>
                 </div>
                 <!-- Display login button if user is not logged in -->
                 <div class="nav-item d-flex align-items-center mt-xs-5" th:if="${session.user == null}">
                     <a href="/login" class="content-max-width btn btn-primary btn-sm ms-2 ms-xs-0">Log in</a>
+                </div>
+                <div class="nav-item d-flex align-items-center mt-xs-5" th:if="${session.user == null}">
+                    <a href="/register" class="content-max-width btn btn-primary btn-sm ms-2 ms-xs-0">Register</a>
                 </div>
             </div>
@@ -141,5 +144,5 @@
     <div class="d-flex justify-content-between align-items-center mb-3">
         <h1 class="h4">Threads</h1>
-        <div th:if="${authenticated}">
+        <div th:if="${session.user!=null}">
             <a href="/topic/create" class="btn btn-success btn-sm">Create Topic</a>
             <a href="project/create" class="btn btn-success btn-sm">Create Project</a>
Index: src/main/resources/templates/home_pages/profile.html
===================================================================
--- src/main/resources/templates/home_pages/profile.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/home_pages/profile.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,3 +1,3 @@
-<!--TODO: make updates avaialbe-->
+<!--TODO: make updates avaialbe i change password da mozish-->
 <!DOCTYPE html>
 <html lang="en">
@@ -10,47 +10,79 @@
 <body class="bg-light">
 <div th:replace="/home_pages/home :: navigation"></div>
-
-<div class="container mt-5 w-50-xs w-75-md">
+<div class="container mt-5 w-50-xs w-75-md " style="width: max-content">
     <!-- User Profile Card -->
-    <div class="card shadow">
+    <div class="card">
         <div class="card-header bg-primary text-white">
             <h4 class="mb-0">User Profile</h4>
         </div>
-        <div class="card-body   d-flex flex-row gap-5 ">
-                <!-- Profile Picture -->
-                <div class="col-md-4 text-center"
-                th:classappend="${canEdit} ? '' : 'd-flex justify-content-center align-items-center'"
+
+        <div class="card-body me-5 ms-5 pe-5 ps-5 d-flex flex-row gap-5 ">
+
+            <!-- Profile Picture -->
+            <div class="col-md-4 flex-grow-2 text-center d-flex justify-content-center align-items-center flex-column"
             >
-                    <img th:src="${user.getAvatarUrl()}" alt="Profile Picture" id="profileImage" class="rounded-circle border border-1 border-info mb-3" style="width: 150px; height: 150px; object-fit: cover;">
-                    <form th:if="${canEdit}" th:action="'/' + ${user.getUsername()} + '/upload-avatar'" method="post" enctype="multipart/form-data" class="mt-3">
-                        <input type="file" id="userImage" name="userImage" accept="image/*" class="form-control mb-2">
-                        <button type="submit" class="btn btn-success btn-sm w-100">Upload Picture</button>
-                    </form>
-                </div>
-                <!-- User Details -->
-            <div class="col-md-7" >
-                    <h5 class="card-title mb-4">Personal Details</h5>
-                    <form class="list-group d-flex flex-column gap-2 list-group-flush">
-                        <label for="username" class="fw-bold ">Username:
-                            <input  th:readonly="${!canEdit}"
-                                    id="username" type="text" th:value="${user.getUsername()}"
-                                    class="w-100 list-group-item">
-                        </label>
-                        <label for="username" class="fw-bold ">Name:
-                            <input  th:readonly="${!canEdit}"
-                                    type="text" th:value="${user.getName()}" class="w-100 list-group-item">
-                        </label>
-                        <label  th:readonly="${!canEdit}"
-                                class="fw-bold ">Email:
-                            <input type="text" th:value="${user.getEmail()}" class="w-100 list-group-item">
-                        </label>
-                        <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center" >Save changes</button>
-                    </form>
-                </div>
+                <form method="post" th:action="@{/{username}/upload-avatar(username=${user.getUsername()})}"  enctype="multipart/form-data">
+                    <img th:src="${user.getAvatarUrl()}" alt="Profile Picture" id="profileImage-input"
+                         class="rounded-circle border border-1 border-info mb-3"
+                         style="width: 150px; height: 150px; object-fit: cover;">
+                    <input type="file" id="userImage" name="userImage" accept="image/*" class="form-control mb-2">
+                    <input type="hidden" th:value="${session.user == null ? '' : session.user.getUsername()}"
+                           name="cur_user_username">
+                    <button type="submit" class="btn btn-success btn-sm w-100">Upload Picture</button>
+                </form>
+            </div>
+            <!-- User Details -->
+            <div th:replace="fragments/user_fields :: user_fields(url=@{/{username}/profile/change(username=${user.getUsername()})})"></div>
+<!--            <form method="post"-->
+<!--                  class="d-flex gap-2 flex-grow-1 flex-column gap-2 list-group-flush "-->
+<!--                  th:action="@{/{username}/profile/change(username=${user.getUsername()})}"-->
+<!--            >-->
+<!--                <h5>Personal Details</h5>-->
+<!--                <label class="fw-bold ">Username:-->
+<!--                    <input th:readonly="${!canEdit}"-->
+<!--                           name="username" type="text" th:value="${user.getUsername()}"-->
+<!--                           class="w-100 border border-secondary ps-2 rounded list-group-item">-->
+<!--                </label>-->
+<!--                <label class="fw-bold ">Name:-->
+<!--                    <input name="name" th:readonly="${!canEdit}"-->
+<!--                           type="text" th:value="${user.getName()}" class="border ps-2 border-secondary rounded w-100 list-group-item">-->
+<!--                </label>-->
+<!--                <label th:readonly="${!canEdit}"-->
+<!--                       class="fw-bold ">Email:-->
+<!--                    <input name="email" type="text" th:value="${user.getEmail()}" class="border ps-2 border-secondary rounded w-100 list-group-item">-->
+<!--                </label>-->
+<!--                <label>-->
+<!--                    <span class="fw-bold d-block">Description</span>-->
+<!--                    <textarea name="description" class="border border-secondary ps-2 rounded w-100" th:readonly="${!canEdit}"-->
+<!--                              th:text="${user.getDescription()}"></textarea>-->
+<!--                </label>-->
+<!--                <label th:readonly="${!canEdit}"-->
+<!--                       class="fw-bold ">Password:-->
+<!--                    <input name="password"-->
+<!--                           placeholder="Leave empty if you don't want to change it"-->
+<!--                           type="text" class="w-100 ps-2 list-group-item border border-secondary rounded">-->
+<!--                </label>-->
+<!--                <input type="hidden" name="cur_user_username"-->
+<!--                       th:value="${session.user == null} ? '' : ${session.user.getUsername()}">-->
+<!--                <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Save changes-->
+<!--                </button>-->
+<!--            </form>-->
+
+            <script>
+                const img = document.querySelector("#profileImage-input");
+                console.log(img)
+                document.querySelector('input[type="file"]').addEventListener("change", ev => {
+                    const [file] = ev.target.files
+                    console.log(file)
+                    if (file) {
+                        console.log(URL.createObjectURL(file))
+                        img.setAttribute("src", URL.createObjectURL(file));
+                    }
+                })
+            </script>
         </div>
     </div>
-</div>
 
-<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
 </body>
 </html>
Index: src/main/resources/templates/home_pages/project_description.html
===================================================================
--- src/main/resources/templates/home_pages/project_description.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/home_pages/project_description.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,3 +1,2 @@
-<!--TODO: napraj so local da se i na makedonski-->
 <!doctype html>
 <html lang="en">
Index: src/main/resources/templates/home_pages/register.html
===================================================================
--- src/main/resources/templates/home_pages/register.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
+++ src/main/resources/templates/home_pages/register.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Register new user</title>
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
+
+</head>
+<body>
+<div th:replace="/home_pages/home :: navigation"></div>
+<div class="container  mt-5" style="width: max-content; min-width: 45vw">
+    <div class="card">
+        <div class="card-header bg-primary text-white">
+            <h4 class="mb-0">Create new user</h4>
+        </div>
+
+        <form method="post"
+              class="d-flex me-5 mt-3 ms-5 mb-3 gap-2 flex-grow-1 flex-column gap-2 list-group-flush "
+              action="/register"
+        >
+            <label class="fw-bold ">Username:
+                <input name="username" type="text" th:value="${user.getUsername()}"
+                       class="w-100 border border-secondary ps-2 rounded list-group-item">
+            </label>
+            <label class="fw-bold ">Name:
+                <input name="name" th:readonly="${!canEdit}"
+                       type="text" th:value="${user.getName()}"
+                       class="border ps-2 border-secondary rounded w-100 list-group-item">
+            </label>
+            <label
+                    class="fw-bold ">Email:
+                <input name="email" type="text" th:value="${user.getEmail()}"
+                       class="border ps-2 border-secondary rounded w-100 list-group-item">
+            </label>
+            <label>
+                <span class="fw-bold d-block">Description</span>
+                <textarea name="description" class="border border-secondary ps-2 rounded w-100"
+                          th:text="${user.getDescription()}"></textarea>
+            </label>
+            <label class="fw-bold ">Password:
+                <input name="password"
+                       placeholder="Leave empty if you don't want to change it"
+                       type="password" class="w-100 ps-2 list-group-item border border-secondary rounded">
+            </label>
+            <div>
+                <label>Choose your gender:</label>
+                <label>
+                    <input name="sex" type="radio" value="male">Male
+                </label>
+                <label>
+                    <input name="sex" type="radio" value="female">Female
+                </label>
+            </div>
+            <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Create user
+            </button>
+        </form>
+    </div>
+</div>
+</body>
+<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
+</html>
Index: src/main/resources/templates/project_pages/project-create.html
===================================================================
--- src/main/resources/templates/project_pages/project-create.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/project_pages/project-create.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -4,5 +4,5 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Add project</title>
+    <title th:text="${isCreatingProject==null} ? 'Modify Project' : 'Add Project' ">Add project</title>
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
 </head>
@@ -13,5 +13,7 @@
     <div class="card shadow-sm">
         <div class="card-header bg-primary text-white">
-            <h4 class="mb-0">Create new project</h4>
+            <h4
+                    th:text="${isCreatingProject==null} ? 'Modify project' : 'Create new project' "
+                    class="mb-0">Create new project</h4>
         </div>
         <div class="card-body">
@@ -35,4 +37,5 @@
                 </div>
                 <button type="submit" class="btn btn-primary w-100">Submit</button>
+                <input th:if="${isCreatingProject==null}" type="hidden" name="username" th:value="${session.user.getUsername()}"/>
             </form>
         </div>
Index: src/main/resources/templates/project_pages/show-project.html
===================================================================
--- src/main/resources/templates/project_pages/show-project.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/project_pages/show-project.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -24,5 +24,5 @@
                 <button class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#addTagModal">
                     <a class="text-decoration-none text-reset"
-                       th:href="@{/project/{pr_title}/modify(pr_title=${project.getTitle()})}">Modify topic</a>
+                       th:href="@{/project/{pr_title}/modify(pr_title=${project.getTitle()})}">Modify project</a>
                 </button>
             </div>
@@ -49,4 +49,5 @@
                                 &times;
                             </button>
+                            <input th:if="${session.user!=null}"  type="hidden" name="username" th:value="${session.user.getUsername()}">
                         </form>
                     </li>
@@ -69,4 +70,24 @@
                 </div>
             </div>
+            <div class="d-flex justify-content-between align-items-center mt-3 pt-3">
+                <div class="d-flex flex-row">
+                    <form th:action="'/project/' + ${project.getTitle()} + '/discussion/like'" method="post">
+                        <input type="hidden" name="threadId" th:value="${project.getId()}">
+                        <button th:if="${session.user!=null}"
+                                type="submit" class="btn btn-outline-success btn-sm me-2 like-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👍 Like (<span th:text="${project.getNumLikes()}">0</span>)
+                        </button>
+                    </form>
+                    <form th:action="'/project/' + ${project.getTitle()} + '/discussion/dislike'" method="post">
+                        <input type="hidden" name="threadId" th:value="${project.getId()}">
+                        <button th:if="${session.user!=null}"
+                                class="btn btn-outline-danger btn-sm dislike-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👎 Dislike
+                        </button>
+                    </form>
+                </div>
+            </div>
         </div>
         <div th:if="${isManager}" class="card-footer d-flex justify-content-between">
@@ -75,4 +96,5 @@
                 <input type="hidden" name="id" th:value="${project.getId()}"/>
                 <button type="submit" class="btn btn-danger btn-sm">Delete Project</button>
+                <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.getUsername()}">
             </form>
         </div>
@@ -103,4 +125,5 @@
                         <input type="text" id="customTag" class="form-control d-none"
                                placeholder="Enter custom tag name"/>
+                        <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.getUsername()}">
                     </div>
                     <button type="submit" class="btn btn-primary w-100">Add Tag</button>
Index: src/main/resources/templates/show-topic.html
===================================================================
--- src/main/resources/templates/show-topic.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ src/main/resources/templates/show-topic.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -44,4 +44,5 @@
                         &times;
                     </button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </span>
@@ -70,4 +71,25 @@
                             </div>
                         </div>
+                        <input type="hidden" th:if="${session.user!=null}" name="username" th:value="${session.user.username}">
+                    </form>
+                </div>
+            </div>
+            <div class="d-flex justify-content-between align-items-center mt-3 pt-3">
+                <div class="d-flex flex-row">
+                    <form th:action="'/topic/' + ${topic.getTitle()} + '/discussion/like'" method="post">
+                        <input type="hidden" name="threadId" th:value="${topic.getId()}">
+                        <button th:if="${session.user!=null}"
+                                type="submit" class="btn btn-outline-success btn-sm me-2 like-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👍 Like (<span th:text="${topic.getNumLikes()}">0</span>)
+                        </button>
+                    </form>
+                    <form th:action="'/topic/' + ${topic.getTitle()} + '/discussion/dislike'" method="post">
+                        <input type="hidden" name="threadId" th:value="${topic.getId()}">
+                        <button th:if="${session.user!=null}"
+                                class="btn btn-outline-danger btn-sm dislike-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👎 Dislike
+                        </button>
                     </form>
                 </div>
@@ -86,4 +108,5 @@
                     <input type="hidden" name="id" th:value="${topic.getId()}"/>
                     <button type="submit" class="btn btn-danger btn-sm">Delete Topic</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -117,4 +140,5 @@
                             th:attr="data-reply-id=${reply.getDiscussion().getId()}">Delete
                     </button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -137,4 +161,5 @@
                             th:onclick="'hideEditReplyBox(' + ${reply.getDiscussion().getId()} + ')'">Cancel
                     </button>
+                    <input th:if="${session.user!=null}"  type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
 
@@ -219,4 +244,5 @@
                     </div>
                     <button  type="submit" class="btn btn-primary w-100">Add Tag</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -246,4 +272,5 @@
                     </div>
                     <button type="submit" class="btn btn-primary w-100">Save Changes</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
Index: target/classes/db/migration/V1__init_ddl.sql
===================================================================
--- target/classes/db/migration/V1__init_ddl.sql	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/db/migration/V1__init_ddl.sql	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -47,10 +47,10 @@
     id            SERIAL PRIMARY KEY,
     username      VARCHAR(32) UNIQUE NOT NULL,
-    email varchar(60) not null,
-    name varchar(32) not null,
-    is_activate   bool,
+    email         varchar(60)        not null,
+    name          varchar(32)        not null,
+    is_activate   bool DEFAULT true,
     password      VARCHAR(72),
     description   VARCHAR(200),
-    registered_at TIMESTAMP,
+    registered_at TIMESTAMP DEFAULT NOW(),
     sex           VARCHAR(1)
 );
@@ -76,5 +76,5 @@
 (
     title     VARCHAR(256) NOT NULL,
-    parent_id INT REFERENCES thread (id),
+    parent_id INT REFERENCES thread (id) on delete cascade,
     id        INT PRIMARY KEY REFERENCES thread (id) on delete cascade
 );
@@ -99,6 +99,6 @@
 CREATE TABLE likes
 (
-    user_id   INT REFERENCES users (id),
-    thread_id INT REFERENCES thread (id),
+    user_id   INT REFERENCES users (id) on delete cascade ,
+    thread_id INT REFERENCES thread (id) on delete cascade,
     PRIMARY KEY (user_id, thread_id)
 );
@@ -139,7 +139,7 @@
 CREATE TABLE developer_associated_with_project
 (
-    project_id   INT REFERENCES thread (id),
-    developer_id INT REFERENCES users (id),
-    started_at   TIMESTAMP,
+    project_id   INT REFERENCES thread (id) on delete cascade,
+    developer_id INT REFERENCES users (id) on delete cascade,
+    started_at   TIMESTAMP DEFAULT NOW(),
     ended_at     TIMESTAMP,
     PRIMARY KEY (project_id, developer_id, started_at)
@@ -158,9 +158,9 @@
 CREATE TABLE users_project_roles
 (
-    user_id    INT REFERENCES users (id),
+    user_id    INT REFERENCES users (id) on delete cascade,
     project_id INT,
     role_name  VARCHAR(32),
     FOREIGN KEY (role_name, project_id)
-        REFERENCES project_roles (name, project_id),
+        REFERENCES project_roles (name, project_id) ON DELETE CASCADE,
     PRIMARY KEY (user_id, project_id, role_name)
 );
@@ -172,5 +172,5 @@
     PRIMARY KEY (permission_name, role_name, project_id),
     FOREIGN KEY (role_name, project_id)
-        REFERENCES project_roles (name, project_id)
+        REFERENCES project_roles (name, project_id) ON DELETE CASCADE
 );
 CREATE TYPE status AS ENUM ('ACCEPTED', 'DENIED', 'PENDING');
@@ -180,6 +180,6 @@
     description VARCHAR(200),
     status      status                     NOT NULL,
-    user_id     INT REFERENCES users (id)  NOT NULL,
-    project_id  INT REFERENCES thread (id) NOT NULL
+    user_id     INT REFERENCES users (id)  ON DELETE CASCADE NOT NULL ,
+    project_id  INT REFERENCES thread (id) ON DELETE CASCADE NOT NULL
 );
 CREATE TABLE report
@@ -264,25 +264,22 @@
 create or replace view v_discussion_thread
 as
-with recursive depth_table as
-(
-    select parent_id, id, 0 as depth
-    from discussion_thread
-    UNION ALL
-    select discuss.parent_id, dpth.id, dpth.depth + 1
-    from depth_table dpth
-    join discussion_thread discuss
-    on dpth.parent_id=discuss.id
-),
-tmp as (
-    select id,max(depth) as depth
-    from depth_table
-    group by id
-)
-select d.id as id ,t.user_id as user_id ,d.depth as depth, d1.parent_id as parent_id
+with recursive
+    depth_table as
+        (select parent_id, id, 0 as depth
+         from discussion_thread
+         UNION ALL
+         select discuss.parent_id, dpth.id, dpth.depth + 1
+         from depth_table dpth
+                  join discussion_thread discuss
+                       on dpth.parent_id = discuss.id),
+    tmp as (select id, max(depth) as depth
+            from depth_table
+            group by id)
+select d.id as id, t.user_id as user_id, d.depth as depth, d1.parent_id as parent_id
 from tmp d
          join depth_table d1
-              on d.id=d1.id and d1.depth=d.depth
+              on d.id = d1.id and d1.depth = d.depth
          join thread t
-              on t.id=d.id;
+              on t.id = d.id;
 -------------------------- FUNCTIONS ----------------------
 CREATE OR REPLACE FUNCTION fn_validate_topic_title()
@@ -304,4 +301,16 @@
 END;
 $$;
+create function check_if_user_exists_in(table_name text, field_name text, field_value text) returns boolean
+    language plpgsql
+as
+$$
+DECLARE
+    result BOOL;
+BEGIN
+    EXECUTE format('SELECT EXISTS (SELECT 1 FROM %I WHERE %I = %L)', table_name, field_name, field_value)
+        INTO result;
+    RETURN result;
+END
+$$;
 CREATE OR REPLACE FUNCTION fn_insert_topics_creator_as_moderator()
     RETURNS TRIGGER
@@ -316,7 +325,9 @@
     FROM v_topic_thread
     WHERE v_topic_thread.id = new.id;
-    INSERT INTO topic_threads_moderators(thread_id, user_id) VALUES (new.id, v_user_id);
+    IF not check_if_user_exists_in('moderator', 'id', v_user_id::text) THEN
+        INSERT INTO topic_threads_moderators(thread_id, user_id) VALUES (new.id, v_user_id);
+    END IF;
     RETURN NEW;
-END;
+END
 $$;
 
@@ -327,12 +338,81 @@
 $$
 DECLARE
-    usrId INT;
+    usrId      INT;
+    new_project_id INT;
 BEGIN
-    SELECT user_id INTO usrId FROM v_project_thread p WHERE NEW.id = p.id;
-    INSERT INTO developer VALUES (usrId);
-    INSERT INTO project_manager VALUES (usrId);
+    SELECT user_id, id
+    into usrId,new_project_id
+    FROM v_project_thread p
+    WHERE NEW.id = p.id;
+    IF not check_if_user_exists_in('developer', 'id', usrId::text) THEN
+        INSERT INTO developer VALUES (usrId);
+        IF NOT EXISTS (
+            select 1
+            from developer_associated_with_project dp
+            where dp.project_id=new_project_id and dp.developer_id=usrId
+        )
+        THEN
+            INSERT INTO developer_associated_with_project(project_id, developer_id, started_at)
+            values (new_project_id, usrId, NOW());
+        END IF;
+    end if;
+    IF not check_if_user_exists_in('project_manager', 'id', usrId::text) THEN
+        INSERT INTO project_manager VALUES (usrId);
+    end if;
     RETURN NEW;
-END;
-$$;
+END
+$$;
+create or replace function fn_remove_unused_tags()
+    returns trigger
+    language plpgsql
+as
+$$
+BEGIN
+    IF not check_if_user_exists_in('tag_threads', 'tag_name', old.tag_name)
+    THEN
+        raise notice 'kakosi';
+        delete from tag t where t.name = old.tag_name;
+    end if;
+    return old;
+end;
+$$;
+create or replace function fn_remove_not_active_project_manager()
+    returns trigger
+    language plpgsql
+as
+$$
+DECLARE
+    creator_id int;
+begin
+    select user_id
+    into creator_id
+    from thread t
+    where t.id = old.id;
+
+    IF NOT EXISTS(select 1
+                  from thread t
+                  where t.id in (select id from project_thread)
+                    and t.user_id = creator_id) THEN
+        delete from project_manager where id = creator_id;
+    end if;
+    return new;
+end
+$$;
+
+create or replace function fn_remove_not_active_developer()
+    returns trigger
+    language plpgsql
+as
+$$
+begin
+    IF not check_if_user_exists_in('developer_associated_with_project','developer_id',old.developer_id::text)
+    THEN
+        delete from developer d
+        where d.id=old.developer_id;
+    end if;
+    return new;
+end
+$$;
+
 -------------------------- TRIGGERS ----------------------
 CREATE OR REPLACE TRIGGER tr_check_topic_name
@@ -352,3 +432,20 @@
 EXECUTE FUNCTION fn_insert_project_manager();
 
----TODO: trigeri za trgnanje na project_owner ako se trgnit project i nekoj takvi dependencies
+create or replace trigger tr_remove_unused_tags
+    after delete
+    on tag_threads
+    for each row
+execute function fn_remove_unused_tags();
+
+create trigger tr_remove_not_project_managers
+    after delete
+    on project_thread
+    for each row
+execute function fn_remove_not_active_project_manager();
+
+create trigger tr_remove_not_active_developer
+    after delete
+    on developer_associated_with_project
+    for each row
+execute function fn_remove_not_active_developer();
+
Index: target/classes/db/migration/V2__add_test_data.sql
===================================================================
--- target/classes/db/migration/V2__add_test_data.sql	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/db/migration/V2__add_test_data.sql	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -35,6 +35,6 @@
 INSERT INTO topic_thread (id, title, parent_id)
 VALUES
-    (1, 'Topic 1' , NULL),
-    (2, 'Topic 2', NULL),
+    (1, 'Topic 1' , 5),
+    (2, 'Topic 2', 5),
     (8, 'Topic 7' , NULL),
     (9, 'Topic 8', NULL),
@@ -67,8 +67,4 @@
     (4, 6),
     (5, 7);
-INSERT INTO topic_belongs_to_project (topic_id, project_id)
-VALUES
-    (1, 5),
-    (2, 5);
 
 INSERT INTO blacklisted_user (topic_id, user_id, moderator_id, start_date, end_date, reason)
@@ -76,9 +72,4 @@
     (1, 2, 1, NOW(), NOW() + INTERVAL '7 days', 'Spamming'),
     (2, 3, 4, NOW(), NOW() + INTERVAL '3 days', 'Offensive language');
-
-INSERT INTO developer_associated_with_project (project_id, developer_id, started_at)
-VALUES
-    (5, 2, NOW()),
-    (5, 3, NOW());
 
 INSERT INTO permissions (name)
Index: target/classes/templates/create-topic.html
===================================================================
--- target/classes/templates/create-topic.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/create-topic.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -26,4 +26,5 @@
         <button type="submit" class="btn btn-primary w-100">Submit</button>
         <input th:if="${!#strings.isEmpty(prefix)}" type="hidden" name="project_title" th:value="${project_title}"/>
+        <input type="hidden" name="username" th:value="${session.user.getUsername()}"/>
       </form>
     </div>
Index: target/classes/templates/fragments/user_fields.html
===================================================================
--- target/classes/templates/fragments/user_fields.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
+++ target/classes/templates/fragments/user_fields.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -0,0 +1,35 @@
+<form method="post"
+      class="d-flex gap-2 flex-grow-1 flex-column gap-2 list-group-flush "
+      th:action="${url}"
+      th:fragment="user_fields(url)"
+>
+    <h5>Personal Details</h5>
+    <label class="fw-bold ">Username:
+        <input th:readonly="${!canEdit}"
+               name="username" type="text" th:value="${user.getUsername()}"
+               class="w-100 border border-secondary ps-2 rounded list-group-item">
+    </label>
+    <label class="fw-bold ">Name:
+        <input name="name" th:readonly="${!canEdit}"
+               type="text" th:value="${user.getName()}" class="border ps-2 border-secondary rounded w-100 list-group-item">
+    </label>
+    <label th:readonly="${!canEdit}"
+           class="fw-bold ">Email:
+        <input name="email" type="text" th:value="${user.getEmail()}" class="border ps-2 border-secondary rounded w-100 list-group-item">
+    </label>
+    <label>
+        <span class="fw-bold d-block">Description</span>
+        <textarea name="description" class="border border-secondary ps-2 rounded w-100" th:readonly="${!canEdit}"
+                  th:text="${user.getDescription()}"></textarea>
+    </label>
+    <label th:readonly="${!canEdit}"
+           class="fw-bold ">Password:
+        <input name="password"
+               placeholder="Leave empty if you don't want to change it"
+               type="password" class="w-100 ps-2 list-group-item border border-secondary rounded">
+    </label>
+    <input type="hidden" name="cur_user_username"
+           th:value="${session.user == null} ? '' : ${session.user.getUsername()}">
+    <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Save changes
+    </button>
+</form>
Index: target/classes/templates/home_pages/home.html
===================================================================
--- target/classes/templates/home_pages/home.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/home_pages/home.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -74,4 +74,7 @@
                     <a href="/login" class="content-max-width btn btn-primary btn-sm ms-2 ms-xs-0">Log in</a>
                 </div>
+                <div class="nav-item d-flex align-items-center mt-xs-5" th:if="${session.user == null}">
+                    <a href="/register" class="content-max-width btn btn-primary btn-sm ms-2 ms-xs-0">Register</a>
+                </div>
             </div>
         </div>
@@ -141,5 +144,5 @@
     <div class="d-flex justify-content-between align-items-center mb-3">
         <h1 class="h4">Threads</h1>
-        <div th:if="${authenticated}">
+        <div th:if="${session.user!=null}">
             <a href="/topic/create" class="btn btn-success btn-sm">Create Topic</a>
             <a href="project/create" class="btn btn-success btn-sm">Create Project</a>
Index: target/classes/templates/home_pages/profile.html
===================================================================
--- target/classes/templates/home_pages/profile.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/home_pages/profile.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,3 +1,3 @@
-<!--TODO: make updates avaialbe-->
+<!--TODO: make updates avaialbe i change password da mozish-->
 <!DOCTYPE html>
 <html lang="en">
@@ -10,47 +10,79 @@
 <body class="bg-light">
 <div th:replace="/home_pages/home :: navigation"></div>
-
-<div class="container mt-5 w-50-xs w-75-md">
+<div class="container mt-5 w-50-xs w-75-md " style="width: max-content">
     <!-- User Profile Card -->
-    <div class="card shadow">
+    <div class="card">
         <div class="card-header bg-primary text-white">
             <h4 class="mb-0">User Profile</h4>
         </div>
-        <div class="card-body   d-flex flex-row gap-5 ">
-                <!-- Profile Picture -->
-                <div class="col-md-4 text-center"
-                th:classappend="${canEdit} ? '' : 'd-flex justify-content-center align-items-center'"
+
+        <div class="card-body me-5 ms-5 pe-5 ps-5 d-flex flex-row gap-5 ">
+
+            <!-- Profile Picture -->
+            <div class="col-md-4 flex-grow-2 text-center d-flex justify-content-center align-items-center flex-column"
             >
-                    <img th:src="${user.getAvatarUrl()}" alt="Profile Picture" id="profileImage" class="rounded-circle border border-1 border-info mb-3" style="width: 150px; height: 150px; object-fit: cover;">
-                    <form th:if="${canEdit}" th:action="'/' + ${user.getUsername()} + '/upload-avatar'" method="post" enctype="multipart/form-data" class="mt-3">
-                        <input type="file" id="userImage" name="userImage" accept="image/*" class="form-control mb-2">
-                        <button type="submit" class="btn btn-success btn-sm w-100">Upload Picture</button>
-                    </form>
-                </div>
-                <!-- User Details -->
-            <div class="col-md-7" >
-                    <h5 class="card-title mb-4">Personal Details</h5>
-                    <form class="list-group d-flex flex-column gap-2 list-group-flush">
-                        <label for="username" class="fw-bold ">Username:
-                            <input  th:readonly="${!canEdit}"
-                                    id="username" type="text" th:value="${user.getUsername()}"
-                                    class="w-100 list-group-item">
-                        </label>
-                        <label for="username" class="fw-bold ">Name:
-                            <input  th:readonly="${!canEdit}"
-                                    type="text" th:value="${user.getName()}" class="w-100 list-group-item">
-                        </label>
-                        <label  th:readonly="${!canEdit}"
-                                class="fw-bold ">Email:
-                            <input type="text" th:value="${user.getEmail()}" class="w-100 list-group-item">
-                        </label>
-                        <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center" >Save changes</button>
-                    </form>
-                </div>
+                <form method="post" th:action="@{/{username}/upload-avatar(username=${user.getUsername()})}"  enctype="multipart/form-data">
+                    <img th:src="${user.getAvatarUrl()}" alt="Profile Picture" id="profileImage-input"
+                         class="rounded-circle border border-1 border-info mb-3"
+                         style="width: 150px; height: 150px; object-fit: cover;">
+                    <input type="file" id="userImage" name="userImage" accept="image/*" class="form-control mb-2">
+                    <input type="hidden" th:value="${session.user == null ? '' : session.user.getUsername()}"
+                           name="cur_user_username">
+                    <button type="submit" class="btn btn-success btn-sm w-100">Upload Picture</button>
+                </form>
+            </div>
+            <!-- User Details -->
+            <div th:replace="fragments/user_fields :: user_fields(url=@{/{username}/profile/change(username=${user.getUsername()})})"></div>
+<!--            <form method="post"-->
+<!--                  class="d-flex gap-2 flex-grow-1 flex-column gap-2 list-group-flush "-->
+<!--                  th:action="@{/{username}/profile/change(username=${user.getUsername()})}"-->
+<!--            >-->
+<!--                <h5>Personal Details</h5>-->
+<!--                <label class="fw-bold ">Username:-->
+<!--                    <input th:readonly="${!canEdit}"-->
+<!--                           name="username" type="text" th:value="${user.getUsername()}"-->
+<!--                           class="w-100 border border-secondary ps-2 rounded list-group-item">-->
+<!--                </label>-->
+<!--                <label class="fw-bold ">Name:-->
+<!--                    <input name="name" th:readonly="${!canEdit}"-->
+<!--                           type="text" th:value="${user.getName()}" class="border ps-2 border-secondary rounded w-100 list-group-item">-->
+<!--                </label>-->
+<!--                <label th:readonly="${!canEdit}"-->
+<!--                       class="fw-bold ">Email:-->
+<!--                    <input name="email" type="text" th:value="${user.getEmail()}" class="border ps-2 border-secondary rounded w-100 list-group-item">-->
+<!--                </label>-->
+<!--                <label>-->
+<!--                    <span class="fw-bold d-block">Description</span>-->
+<!--                    <textarea name="description" class="border border-secondary ps-2 rounded w-100" th:readonly="${!canEdit}"-->
+<!--                              th:text="${user.getDescription()}"></textarea>-->
+<!--                </label>-->
+<!--                <label th:readonly="${!canEdit}"-->
+<!--                       class="fw-bold ">Password:-->
+<!--                    <input name="password"-->
+<!--                           placeholder="Leave empty if you don't want to change it"-->
+<!--                           type="text" class="w-100 ps-2 list-group-item border border-secondary rounded">-->
+<!--                </label>-->
+<!--                <input type="hidden" name="cur_user_username"-->
+<!--                       th:value="${session.user == null} ? '' : ${session.user.getUsername()}">-->
+<!--                <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Save changes-->
+<!--                </button>-->
+<!--            </form>-->
+
+            <script>
+                const img = document.querySelector("#profileImage-input");
+                console.log(img)
+                document.querySelector('input[type="file"]').addEventListener("change", ev => {
+                    const [file] = ev.target.files
+                    console.log(file)
+                    if (file) {
+                        console.log(URL.createObjectURL(file))
+                        img.setAttribute("src", URL.createObjectURL(file));
+                    }
+                })
+            </script>
         </div>
     </div>
-</div>
 
-<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
 </body>
 </html>
Index: target/classes/templates/home_pages/project_description.html
===================================================================
--- target/classes/templates/home_pages/project_description.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/home_pages/project_description.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -1,3 +1,2 @@
-<!--TODO: napraj so local da se i na makedonski-->
 <!doctype html>
 <html lang="en">
Index: target/classes/templates/home_pages/register.html
===================================================================
--- target/classes/templates/home_pages/register.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
+++ target/classes/templates/home_pages/register.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Register new user</title>
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
+
+</head>
+<body>
+<div th:replace="/home_pages/home :: navigation"></div>
+<div class="container  mt-5" style="width: max-content; min-width: 45vw">
+    <div class="card">
+        <div class="card-header bg-primary text-white">
+            <h4 class="mb-0">Create new user</h4>
+        </div>
+
+        <form method="post"
+              class="d-flex me-5 mt-3 ms-5 mb-3 gap-2 flex-grow-1 flex-column gap-2 list-group-flush "
+              action="/register"
+        >
+            <label class="fw-bold ">Username:
+                <input name="username" type="text" th:value="${user.getUsername()}"
+                       class="w-100 border border-secondary ps-2 rounded list-group-item">
+            </label>
+            <label class="fw-bold ">Name:
+                <input name="name" th:readonly="${!canEdit}"
+                       type="text" th:value="${user.getName()}"
+                       class="border ps-2 border-secondary rounded w-100 list-group-item">
+            </label>
+            <label
+                    class="fw-bold ">Email:
+                <input name="email" type="text" th:value="${user.getEmail()}"
+                       class="border ps-2 border-secondary rounded w-100 list-group-item">
+            </label>
+            <label>
+                <span class="fw-bold d-block">Description</span>
+                <textarea name="description" class="border border-secondary ps-2 rounded w-100"
+                          th:text="${user.getDescription()}"></textarea>
+            </label>
+            <label class="fw-bold ">Password:
+                <input name="password"
+                       placeholder="Leave empty if you don't want to change it"
+                       type="password" class="w-100 ps-2 list-group-item border border-secondary rounded">
+            </label>
+            <div>
+                <label>Choose your gender:</label>
+                <label>
+                    <input name="sex" type="radio" value="male">Male
+                </label>
+                <label>
+                    <input name="sex" type="radio" value="female">Female
+                </label>
+            </div>
+            <button th:if="${canEdit}" class="btn btn-success btn-sm w-50 align-self-center">Create user
+            </button>
+        </form>
+    </div>
+</div>
+</body>
+<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
+</html>
Index: target/classes/templates/project_pages/project-create.html
===================================================================
--- target/classes/templates/project_pages/project-create.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/project_pages/project-create.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -4,5 +4,5 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Add project</title>
+    <title th:text="${isCreatingProject==null} ? 'Modify Project' : 'Add Project' ">Add project</title>
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
 </head>
@@ -13,5 +13,7 @@
     <div class="card shadow-sm">
         <div class="card-header bg-primary text-white">
-            <h4 class="mb-0">Create new project</h4>
+            <h4
+                    th:text="${isCreatingProject==null} ? 'Modify project' : 'Create new project' "
+                    class="mb-0">Create new project</h4>
         </div>
         <div class="card-body">
@@ -35,4 +37,5 @@
                 </div>
                 <button type="submit" class="btn btn-primary w-100">Submit</button>
+                <input th:if="${isCreatingProject==null}" type="hidden" name="username" th:value="${session.user.getUsername()}"/>
             </form>
         </div>
Index: target/classes/templates/project_pages/show-project.html
===================================================================
--- target/classes/templates/project_pages/show-project.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/project_pages/show-project.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -24,5 +24,5 @@
                 <button class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#addTagModal">
                     <a class="text-decoration-none text-reset"
-                       th:href="@{/project/{pr_title}/modify(pr_title=${project.getTitle()})}">Modify topic</a>
+                       th:href="@{/project/{pr_title}/modify(pr_title=${project.getTitle()})}">Modify project</a>
                 </button>
             </div>
@@ -49,4 +49,5 @@
                                 &times;
                             </button>
+                            <input th:if="${session.user!=null}"  type="hidden" name="username" th:value="${session.user.getUsername()}">
                         </form>
                     </li>
@@ -69,4 +70,24 @@
                 </div>
             </div>
+            <div class="d-flex justify-content-between align-items-center mt-3 pt-3">
+                <div class="d-flex flex-row">
+                    <form th:action="'/project/' + ${project.getTitle()} + '/discussion/like'" method="post">
+                        <input type="hidden" name="threadId" th:value="${project.getId()}">
+                        <button th:if="${session.user!=null}"
+                                type="submit" class="btn btn-outline-success btn-sm me-2 like-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👍 Like (<span th:text="${project.getNumLikes()}">0</span>)
+                        </button>
+                    </form>
+                    <form th:action="'/project/' + ${project.getTitle()} + '/discussion/dislike'" method="post">
+                        <input type="hidden" name="threadId" th:value="${project.getId()}">
+                        <button th:if="${session.user!=null}"
+                                class="btn btn-outline-danger btn-sm dislike-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👎 Dislike
+                        </button>
+                    </form>
+                </div>
+            </div>
         </div>
         <div th:if="${isManager}" class="card-footer d-flex justify-content-between">
@@ -75,4 +96,5 @@
                 <input type="hidden" name="id" th:value="${project.getId()}"/>
                 <button type="submit" class="btn btn-danger btn-sm">Delete Project</button>
+                <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.getUsername()}">
             </form>
         </div>
@@ -103,4 +125,5 @@
                         <input type="text" id="customTag" class="form-control d-none"
                                placeholder="Enter custom tag name"/>
+                        <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.getUsername()}">
                     </div>
                     <button type="submit" class="btn btn-primary w-100">Add Tag</button>
Index: target/classes/templates/show-topic.html
===================================================================
--- target/classes/templates/show-topic.html	(revision e29248c09cbb98bcb969c1b42b78bd979a269952)
+++ target/classes/templates/show-topic.html	(revision 107d059fca4a59abe5660f293845c2ce50d2beed)
@@ -44,4 +44,5 @@
                         &times;
                     </button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </span>
@@ -70,4 +71,25 @@
                             </div>
                         </div>
+                        <input type="hidden" th:if="${session.user!=null}" name="username" th:value="${session.user.username}">
+                    </form>
+                </div>
+            </div>
+            <div class="d-flex justify-content-between align-items-center mt-3 pt-3">
+                <div class="d-flex flex-row">
+                    <form th:action="'/topic/' + ${topic.getTitle()} + '/discussion/like'" method="post">
+                        <input type="hidden" name="threadId" th:value="${topic.getId()}">
+                        <button th:if="${session.user!=null}"
+                                type="submit" class="btn btn-outline-success btn-sm me-2 like-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👍 Like (<span th:text="${topic.getNumLikes()}">0</span>)
+                        </button>
+                    </form>
+                    <form th:action="'/topic/' + ${topic.getTitle()} + '/discussion/dislike'" method="post">
+                        <input type="hidden" name="threadId" th:value="${topic.getId()}">
+                        <button th:if="${session.user!=null}"
+                                class="btn btn-outline-danger btn-sm dislike-button">
+                            <!--                                th:attr="data-reply-id=${reply.getDiscussion().getId()}">-->
+                            👎 Dislike
+                        </button>
                     </form>
                 </div>
@@ -86,4 +108,5 @@
                     <input type="hidden" name="id" th:value="${topic.getId()}"/>
                     <button type="submit" class="btn btn-danger btn-sm">Delete Topic</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -117,4 +140,5 @@
                             th:attr="data-reply-id=${reply.getDiscussion().getId()}">Delete
                     </button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -137,4 +161,5 @@
                             th:onclick="'hideEditReplyBox(' + ${reply.getDiscussion().getId()} + ')'">Cancel
                     </button>
+                    <input th:if="${session.user!=null}"  type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
 
@@ -219,4 +244,5 @@
                     </div>
                     <button  type="submit" class="btn btn-primary w-100">Add Tag</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
@@ -246,4 +272,5 @@
                     </div>
                     <button type="submit" class="btn btn-primary w-100">Save Changes</button>
+                    <input th:if="${session.user!=null}" type="hidden" name="username" th:value="${session.user.username}"/>
                 </form>
             </div>
