Ignore:
Timestamp:
02/05/23 19:55:10 (21 months ago)
Author:
Gjoko Kostadinov <gjoko.kostadinov@…>
Branches:
master
Children:
2b0a4db
Parents:
cc52b09
Message:

Adding customer registration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/services/StakeholderService.java

    rcc52b09 ra436340  
    44import edu.gjoko.schedlr.entity.StakeholderType;
    55import edu.gjoko.schedlr.repositories.StakeholderRepository;
     6import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
    67import org.springframework.stereotype.Service;
    78
     
    1011
    1112    private StakeholderRepository stakeholderRepository;
     13    private BCryptPasswordEncoder bCryptPasswordEncoder;
    1214
    13     public StakeholderService(StakeholderRepository stakeholderRepository) {
     15    public StakeholderService(StakeholderRepository stakeholderRepository,
     16                              BCryptPasswordEncoder bCryptPasswordEncoder) {
    1417        this.stakeholderRepository = stakeholderRepository;
     18        this.bCryptPasswordEncoder = bCryptPasswordEncoder;
    1519    }
    1620
    1721    public Stakeholder saveStakeholder(Stakeholder stakeholder) {
     22        stakeholder.setPassword(bCryptPasswordEncoder.encode(stakeholder.getPassword()));
    1823        stakeholder.setStakeholderType(StakeholderType.CUSTOMER);
    1924        return stakeholderRepository.save(stakeholder);
Note: See TracChangeset for help on using the changeset viewer.