|
|
|
|
@ -6,6 +6,7 @@ import android.content.Context;
|
|
|
|
|
import android.content.pm.ApplicationInfo;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
import com.rehome.zhdcoa.Contans;
|
|
|
|
|
import com.rehome.zhdcoa.bean.DeviceAlarmLoginResultBean;
|
|
|
|
|
import com.rehome.zhdcoa.bean.DeviceAlarmLoginResultDataBean;
|
|
|
|
|
@ -14,9 +15,12 @@ import com.yolanda.nohttp.NoHttp;
|
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
|
import com.yolanda.nohttp.rest.Response;
|
|
|
|
|
|
|
|
|
|
import static com.rehome.zhdcoa.utils.GsonUtils.GsonToBean;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import javax.net.ssl.HostnameVerifier;
|
|
|
|
|
import javax.net.ssl.SSLSession;
|
|
|
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
|
|
|
@ -375,26 +379,18 @@ public class AuthenticationLoginAIUtils {
|
|
|
|
|
showLog(result, mActivity);
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(result)) {
|
|
|
|
|
DeviceAlarmLoginResultBean bean = GsonToBean(result, DeviceAlarmLoginResultBean.class);
|
|
|
|
|
if (bean != null) {
|
|
|
|
|
if (bean.isSuccess()&&bean.getCode()==20000) {//登录成功
|
|
|
|
|
if(!TextUtils.isEmpty(bean.getData())){
|
|
|
|
|
String jsonDecode = RSAUtils.decryptBASE64StrClient(bean.getData());
|
|
|
|
|
String jsonDecode = RSAUtils.decryptBASE64StrClient(result);
|
|
|
|
|
if (TextUtils.isEmpty(jsonDecode)) {
|
|
|
|
|
//解密失败
|
|
|
|
|
showLog("APP解密失败", mActivity);
|
|
|
|
|
listener.onAuthenticationSuccess(false, "");
|
|
|
|
|
} else {
|
|
|
|
|
//showLog(jsonDecode,mActivity);
|
|
|
|
|
DeviceAlarmLoginResultDataBean beanDecode = GsonToBean(jsonDecode, DeviceAlarmLoginResultDataBean.class);
|
|
|
|
|
if(beanDecode!=null&&beanDecode.getMsg()!=null&&"登录成功".equals(beanDecode.getMsg())){
|
|
|
|
|
listener.onAuthenticationSuccess(true, beanDecode.getToken());
|
|
|
|
|
}else{
|
|
|
|
|
showLog("账号或密码错误",mActivity);
|
|
|
|
|
listener.onAuthenticationSuccess(false, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
showLog(jsonDecode, mActivity);
|
|
|
|
|
UserAuthenticationAIBean bean = GsonToBean(jsonDecode, UserAuthenticationAIBean.class);
|
|
|
|
|
//DeviceAlarmLoginResultBean bean = GsonToBean(result, DeviceAlarmLoginResultBean.class);
|
|
|
|
|
if (bean != null) {
|
|
|
|
|
if (bean.isSuccess() && bean.getCode() == 20000) {//登录成功
|
|
|
|
|
listener.onAuthenticationSuccess(true, bean.getData().getToken());
|
|
|
|
|
} else {
|
|
|
|
|
if (bean.getFlag() == -1) {
|
|
|
|
|
if (bean.getMsg() != null && bean.getMsg().equals("用户未注销")) {
|
|
|
|
|
@ -423,6 +419,7 @@ public class AuthenticationLoginAIUtils {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailed(int what, Response<String> response) {
|
|
|
|
|
|