Updated student html and made the creation date mandatory for basic entity.
This commit is contained in:
parent
241a57b282
commit
70df5c74ea
|
@ -51,8 +51,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
.and()
|
.and()
|
||||||
|
|
||||||
.authorizeRequests() // Only logged in users should be able to see site content.
|
.authorizeRequests() // Only logged in users should be able to see site content.
|
||||||
.antMatchers("/**").authenticated()
|
.antMatchers("/**").hasRole("user")
|
||||||
.anyRequest().authenticated()
|
.anyRequest().hasRole("user")
|
||||||
.and()
|
.and()
|
||||||
|
|
||||||
.formLogin()
|
.formLogin()
|
||||||
|
@ -72,6 +72,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
.deleteCookies("JSESSIONID");
|
.deleteCookies("JSESSIONID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Spring Security to use a specific password encoder.
|
||||||
|
* @return The password encoder to use.
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public PasswordEncoder passwordEncoder() {
|
public PasswordEncoder passwordEncoder() {
|
||||||
return new BCryptPasswordEncoder();
|
return new BCryptPasswordEncoder();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public abstract class BasicEntity {
|
||||||
value = TemporalType.TIMESTAMP
|
value = TemporalType.TIMESTAMP
|
||||||
)
|
)
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@Column
|
@Column(nullable = false)
|
||||||
private Date createdOn;
|
private Date createdOn;
|
||||||
|
|
||||||
protected BasicEntity() {}
|
protected BasicEntity() {}
|
||||||
|
|
|
@ -7,6 +7,9 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom user details service to supply database persistent user information to Spring Security.
|
||||||
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class UserDetailsService implements org.springframework.security.core.userdetails.UserDetailsService {
|
public class UserDetailsService implements org.springframework.security.core.userdetails.UserDetailsService {
|
||||||
|
|
||||||
|
|
|
@ -6,28 +6,27 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<p>
|
<p>
|
||||||
Here you can register to create a new account to access the information provided by this application, whether you are a professor, teaching assistant, or student. After filling out this submission form, you'll receive an email with a link to verify that you are who you say you are, after which your account will be activated.
|
To register as a student, please fill out the form below. Make sure to double-check that all information is entered is accurate.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Where the form asks for a <em>Registration Code</em>, please provide the code that has been given to you by your lecturers. This code ensures that you'll join the right course.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<h3>I am a ...</h3>
|
<div class="col">
|
||||||
</div>
|
<form action="/register/student" method="post" enctype="application/x-www-form-urlencoded">
|
||||||
|
<div class="form-group">
|
||||||
<div class="row justify-content-center">
|
<label>
|
||||||
<div class="col text-center">
|
Registration Code:
|
||||||
<a class="btn btn-primary" th:href="@{/register/student}">Student</a>
|
<input type="text" name="registration_code" class="form-control">
|
||||||
</div>
|
</label>
|
||||||
<div class="col text-center">
|
</div>
|
||||||
<a class="btn btn-primary" th:href="@{/register/teaching_assistant}">Teaching Assistant</a>
|
</form>
|
||||||
</div>
|
|
||||||
<div class="col text-center">
|
|
||||||
<a class="btn btn-primary" th:href="@{/register/administrator}">Administrator</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue