| Line 7... |
Line 7... |
| 7 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
7 |
import com.spice.profitmandi.dao.entity.dtr.*;
|
| 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.thrift.clients.TransactionClient;
|
13 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
| 13 |
import in.shop2020.model.v1.order.TransactionService;
|
14 |
import in.shop2020.model.v1.order.TransactionService;
|
| 14 |
import org.apache.commons.lang.RandomStringUtils;
|
15 |
import org.apache.commons.lang.RandomStringUtils;
|
| 15 |
import org.hibernate.Criteria;
|
16 |
import org.hibernate.Criteria;
|
| 16 |
import org.hibernate.Session;
|
17 |
import org.hibernate.Session;
|
| Line 59... |
Line 60... |
| 59 |
@Autowired
|
60 |
@Autowired
|
| 60 |
private RoleRepository roleRepository;
|
61 |
private RoleRepository roleRepository;
|
| 61 |
|
62 |
|
| 62 |
@Autowired
|
63 |
@Autowired
|
| 63 |
JavaMailSender mailSender;
|
64 |
JavaMailSender mailSender;
|
| - |
|
65 |
|
| - |
|
66 |
@Autowired
|
| - |
|
67 |
AuthService authService;
|
| 64 |
|
68 |
|
| 65 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
69 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
| 66 |
|
70 |
|
| 67 |
@SuppressWarnings("deprecation")
|
71 |
@SuppressWarnings("deprecation")
|
| 68 |
@Override
|
72 |
@Override
|
| Line 152... |
Line 156... |
| 152 |
try {
|
156 |
try {
|
| 153 |
Utils.sendMailWithAttachments(mailSender, user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), null);
|
157 |
Utils.sendMailWithAttachments(mailSender, user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), null);
|
| 154 |
} catch (Exception e) {
|
158 |
} catch (Exception e) {
|
| 155 |
throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
|
159 |
throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
|
| 156 |
}
|
160 |
}
|
| 157 |
user.setPassword(encrypter.encrypt(password));
|
161 |
//user.setPassword(encrypter.encrypt(password));
|
| - |
|
162 |
authService.resetPassword(emailOrMobile, password);
|
| 158 |
}
|
163 |
}
|
| 159 |
|
164 |
|
| 160 |
@Override
|
165 |
@Override
|
| 161 |
public boolean resetPassword(String emailMobile, String password) throws ProfitMandiBusinessException {
|
166 |
public boolean resetPassword(String emailMobile, String password) throws ProfitMandiBusinessException {
|
| 162 |
User user = userRepository.selectByEmailIdOrMobileNumber(emailMobile);
|
167 |
User user = userRepository.selectByEmailIdOrMobileNumber(emailMobile);
|
| 163 |
user.setPassword(encrypter.encrypt(password));
|
168 |
user.setPassword(encrypter.encrypt(password));
|
| - |
|
169 |
return true;
|
| - |
|
170 |
}
|
| - |
|
171 |
|
| - |
|
172 |
@Override
|
| - |
|
173 |
public boolean changePassword(User user, String password) throws ProfitMandiBusinessException {
|
| 164 |
userRepository.persist(user);
|
174 |
authService.resetPassword(user.getEmailId(), password);
|
| 165 |
return true;
|
175 |
return true;
|
| 166 |
}
|
176 |
}
|
| 167 |
|
177 |
|
| 168 |
private String getRandomString() {
|
178 |
private String getRandomString() {
|
| 169 |
int length = 10;
|
179 |
int length = 10;
|