/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package wepa.wepa.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class DefaultController {

    @RequestMapping("*")
    public String handleDefault() {
        return "index";
    }
}
@@ -213,167 +213,1022 @@
 r;%0A%0A
-%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0A%0A@Controller%0Apublic class DefaultController %7B
+import java.util.Arrays;%0Aimport java.util.List;%0Aimport javax.annotation.PostConstruct;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.security.crypto.password.PasswordEncoder;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport wepa.wepa.domain.Person;%0Aimport wepa.wepa.repository.PersonRepository;%0A%0A@Controller%0Apublic class DefaultController %7B%0A%0A    @Autowired%0A    private PasswordEncoder passwordEncoder;%0A    @Autowired%0A    private PersonRepository personRepository;%0A%0A    @PostConstruct%0A    public void init() %7B%0A%0A        List%3CPerson%3E users = personRepository.findAll();%0A        if (users.isEmpty()) %7B%0A            Person user = new Person();%0A            user.setName(%22teach%22);%0A            user.setStudentNumber(%22000000000%22);%0A            user.setPassword(passwordEncoder.encode(%22teach%22));%0A            user.setAuthorities(Arrays.asList(%22TEACHER%22));%0A            personRepository.save(user);%0A        %7D%0A    %7D
 %0A%0A  
@@ -1317,8 +1317,9 @@
 %0A    %7D%0A%7D
+%0A

create default user if no users exist