| Line 8... |
Line 8... |
| 8 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
8 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 9 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
9 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
| 10 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
10 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
| 11 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
11 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 12 |
import com.spice.profitmandi.service.AuthService;
|
12 |
import com.spice.profitmandi.service.AuthService;
|
| - |
|
13 |
import com.spice.profitmandi.service.mail.MailOutboxService;
|
| 13 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
14 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
| 14 |
import in.shop2020.model.v1.order.TransactionService;
|
15 |
import in.shop2020.model.v1.order.TransactionService;
|
| 15 |
import org.apache.commons.lang.RandomStringUtils;
|
16 |
import org.apache.commons.lang.RandomStringUtils;
|
| 16 |
import org.hibernate.Criteria;
|
17 |
import org.hibernate.Criteria;
|
| 17 |
import org.hibernate.Session;
|
18 |
import org.hibernate.Session;
|
| Line 62... |
Line 63... |
| 62 |
|
63 |
|
| 63 |
@Autowired
|
64 |
@Autowired
|
| 64 |
JavaMailSender mailSender;
|
65 |
JavaMailSender mailSender;
|
| 65 |
|
66 |
|
| 66 |
@Autowired
|
67 |
@Autowired
|
| - |
|
68 |
MailOutboxService mailOutboxService;
|
| - |
|
69 |
|
| - |
|
70 |
@Autowired
|
| 67 |
AuthService authService;
|
71 |
AuthService authService;
|
| 68 |
|
72 |
|
| 69 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
73 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
| 70 |
|
74 |
|
| 71 |
@SuppressWarnings("deprecation")
|
75 |
@SuppressWarnings("deprecation")
|
| Line 152... |
Line 156... |
| 152 |
@Override
|
156 |
@Override
|
| 153 |
public void resetPassword(String emailOrMobile) throws ProfitMandiBusinessException {
|
157 |
public void resetPassword(String emailOrMobile) throws ProfitMandiBusinessException {
|
| 154 |
User user = userRepository.selectByEmailId(emailOrMobile);
|
158 |
User user = userRepository.selectByEmailId(emailOrMobile);
|
| 155 |
String password = getRandomString();
|
159 |
String password = getRandomString();
|
| 156 |
try {
|
160 |
try {
|
| 157 |
Utils.sendMailWithAttachments(mailSender, user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), null);
|
161 |
mailOutboxService.queueMail(user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), "UserServiceImpl.resetPassword");
|
| 158 |
} catch (Exception e) {
|
162 |
} catch (Exception e) {
|
| 159 |
throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
|
163 |
throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
|
| 160 |
}
|
164 |
}
|
| 161 |
//user.setPassword(encrypter.encrypt(password));
|
165 |
//user.setPassword(encrypter.encrypt(password));
|
| 162 |
authService.resetPassword(emailOrMobile, password);
|
166 |
authService.resetPassword(emailOrMobile, password);
|