|
|
@ -18,6 +18,7 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
import au.com.royalpay.payment.tools.env.RequestEnvironment;
|
|
|
|
import au.com.royalpay.payment.tools.env.RequestEnvironment;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PasswordUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PasswordUtils;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@ -138,7 +139,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
|
|
|
|
validLoginInfo(loginInfo, account);
|
|
|
|
validLoginInfo(loginInfo, account);
|
|
|
|
JSONObject client = clientManager.getClientInfoIgnoreInvalid(account.getIntValue("client_id"));
|
|
|
|
JSONObject client = clientManager.getClientInfoIgnoreInvalid(account.getIntValue("client_id"));
|
|
|
|
if (client != null && !client.getBooleanValue("is_valid")) {
|
|
|
|
if (client != null && !client.getBooleanValue("is_valid")) {
|
|
|
|
throw new BadRequestException("用户名或密码不正确");
|
|
|
|
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
validLoginInfo(loginInfo, account);
|
|
|
|
validLoginInfo(loginInfo, account);
|
|
|
|
publisher.publishEvent(new ManagerLoginEvent(this, account.getString("manager_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
|
|
|
|
publisher.publishEvent(new ManagerLoginEvent(this, account.getString("manager_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
|
|
|
@ -147,12 +148,12 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
|
|
|
|
|
|
|
|
|
|
|
|
private void validLoginInfo(LoginInfo loginInfo, JSONObject account) {
|
|
|
|
private void validLoginInfo(LoginInfo loginInfo, JSONObject account) {
|
|
|
|
if (account == null) {
|
|
|
|
if (account == null) {
|
|
|
|
throw new BadRequestException("用户名或密码不正确");
|
|
|
|
throw new BadRequestException(LocaleSupport.localeMessage("login.error.password"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String salt = account.getString("salt");
|
|
|
|
String salt = account.getString("salt");
|
|
|
|
String pwdHash = loginInfo.getPasswordHashed(salt);
|
|
|
|
String pwdHash = loginInfo.getPasswordHashed(salt);
|
|
|
|
if (!StringUtils.equals(pwdHash, account.getString("password_hash"))) {
|
|
|
|
if (!StringUtils.equals(pwdHash, account.getString("password_hash"))) {
|
|
|
|
throw new BadRequestException("用户名或密码不正确");
|
|
|
|
throw new BadRequestException(LocaleSupport.localeMessage("login.error.password"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|