package fr.intech.s5.candiesforall.backend.converter;

import org.springframework.core.convert.converter.Converter;

import fr.intech.s5.candiesforall.backend.entity.Login;
import fr.intech.s5.candiesforall.backend.model.request.LoginRequest;
import fr.intech.s5.candiesforall.backend.util.security.Cryptography;

public class LoginRequestToLoginConverter implements Converter<LoginRequest, Login> {

	@Override
	public Login convert(LoginRequest source) {
		
		Login login = new Login();
		
		login.setUserName( source.getUserName() );
		login.setUserPassword( Cryptography.sha256( source.getUserPassword() ) );
		
		return login;
	}

}
