Skip to content

Instantly share code, notes, and snippets.

Choonghee Lee choonghee-lee

Block or report user

Report or block choonghee-lee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RegistrationController.java
@Controller
class RegistrationController {
@Autowired
private ApplicationEventPublisher eventPublisher; // 이벤트 발행기
@Autowired
private IUserService userService; // 유저 서비스
// 회원 가입페이지
View RegistrationListener.java
@Component
public class RegistrationListener implements ApplicationListener<OnRegistrationCompleteEvent> {
@Autowired
private IUserService service;
@Autowired
private JavaMailSender mailSender;
@Autowired
View OnRegistrationCompleteEvent.java
public class OnRegistrationCompleteEvent extends ApplicationEvent {
private final String appUrl;
private final User user;
public OnRegistrationCompleteEvent(final User user, final String appUrl) {
super(user);
this.user = user;
this.appUrl = appUrl;
}
@choonghee-lee
choonghee-lee / VerificationToken.java
Last active Jul 20, 2019
verification token entity
View VerificationToken.java
@Entity
public class VerificationToken {
// 만료기간
private static final int EXPIRATION = 60 * 24;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String token;
View User.java
@Entity
@PasswordMatches
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Email
@NotEmpty(message = "Email is required.")
@choonghee-lee
choonghee-lee / pom.xml
Created Jul 20, 2019
spring boot starter mail dependency
View pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
@choonghee-lee
choonghee-lee / forgotPassword.html
Created Jul 19, 2019
html page to find a password
View forgotPassword.html
<form th:action="@{/user/resetPassword}" method="post" class="form-horizontal">
<div class="row">
<label class="col-sm-1" for="email">Email:</label> <span class="col-sm-5"><input class="form-control" id="email" name="email" type="email" /></span>
<button class="btn btn-primary" type="submit">Reset Password</button>
</div>
</form>
@choonghee-lee
choonghee-lee / RegistrationController.java
Last active Jul 18, 2019
registeration rest controller
View RegistrationController.java
@RestController
public class RegistrationController {
private NotificationService notificationService;
public RegistrationController(NotificationService notificationService) {
this.notificationService = notificationService;
}
@GetMapping("/signup")
@choonghee-lee
choonghee-lee / NotificationService.java
Last active Jul 18, 2019
simple sending an email service
View NotificationService.java
@Service
public class NotificationService {
private JavaMailSender javaMailSender;
@Autowired
public NotificationService(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
@choonghee-lee
choonghee-lee / application.properties
Created Jul 18, 2019
properties for sending email
View application.properties
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=gmail 주소
spring.mail.password=gmail 비밀번호
spring.mail.properties.mail.smtp.starttls.enable=true
You can’t perform that action at this time.