| Line 9... |
Line 9... |
| 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.service.mail.MailOutboxService;
|
| 14 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
- |
|
| 15 |
import in.shop2020.model.v1.order.TransactionService;
|
- |
|
| 16 |
import org.apache.commons.lang.RandomStringUtils;
|
14 |
import org.apache.commons.lang.RandomStringUtils;
|
| 17 |
import org.hibernate.Criteria;
|
15 |
import org.hibernate.Criteria;
|
| 18 |
import org.hibernate.Session;
|
16 |
import org.hibernate.Session;
|
| 19 |
import org.hibernate.SessionFactory;
|
17 |
import org.hibernate.SessionFactory;
|
| 20 |
import org.hibernate.criterion.Restrictions;
|
18 |
import org.hibernate.criterion.Restrictions;
|
| Line 73... |
Line 71... |
| 73 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
71 |
private static final DesEncrypter encrypter = new DesEncrypter("saholic");
|
| 74 |
|
72 |
|
| 75 |
@SuppressWarnings("deprecation")
|
73 |
@SuppressWarnings("deprecation")
|
| 76 |
@Override
|
74 |
@Override
|
| 77 |
public boolean updateActivation(int userId, int retailerId, String activationCode) throws Throwable {
|
75 |
public boolean updateActivation(int userId, int retailerId, String activationCode) throws Throwable {
|
| 78 |
|
- |
|
| 79 |
TransactionClient transactionServiceClient = new TransactionClient();
|
- |
|
| 80 |
TransactionService.Client tsc = transactionServiceClient.getClient();
|
- |
|
| 81 |
boolean registered = tsc.registerRsa(retailerId, activationCode);
|
76 |
boolean registered = false;
|
| 82 |
|
- |
|
| 83 |
Session session = sessionFactory.getCurrentSession();
|
77 |
Session session = sessionFactory.getCurrentSession();
|
| 84 |
|
78 |
|
| 85 |
if(!registered){
|
- |
|
| 86 |
Criteria cr = session.createCriteria(ActivationCode.class);
|
79 |
Criteria cr = session.createCriteria(ActivationCode.class);
|
| 87 |
cr.add(Restrictions.eq("code", activationCode)).add(Restrictions.eq("status", true));
|
80 |
cr.add(Restrictions.eq("code", activationCode)).add(Restrictions.eq("status", true));
|
| 88 |
ActivationCode code = (ActivationCode)cr.uniqueResult();
|
81 |
ActivationCode code = (ActivationCode)cr.uniqueResult();
|
| 89 |
if(code==null) {
|
82 |
if(code == null) {
|
| 90 |
return false;
|
83 |
return false;
|
| 91 |
} else {
|
84 |
} else {
|
| 92 |
registered=true;
|
85 |
registered = true;
|
| 93 |
code.setStatus(false);
|
86 |
code.setStatus(false);
|
| 94 |
session.update(code);
|
87 |
session.update(code);
|
| 95 |
}
|
- |
|
| 96 |
}
|
88 |
}
|
| 97 |
|
89 |
|
| 98 |
if(registered) {
|
90 |
if(registered) {
|
| 99 |
User user = userRepository.selectById(userId);
|
91 |
User user = userRepository.selectById(userId);
|
| 100 |
user.setActivated(true);
|
92 |
user.setActivated(true);
|