mirror of https://gitee.com/topiam/eiam
⚡ 优化
parent
4c0f5eb8aa
commit
29f54ece54
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* eiam-common - Employee Identity and Access Management
|
* eiam-authentication-mail - Employee Identity and Access Management
|
||||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -15,22 +15,4 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package cn.topiam.employee.common.exception;
|
package cn.topiam.employee.authentication.otp.mail.configurer;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
|
|
||||||
import cn.topiam.employee.support.exception.TopIamException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息 发送异常
|
|
||||||
*
|
|
||||||
* @author TopIAM
|
|
||||||
* Created by support@topiam.cn on 2022/8/7 23:03
|
|
||||||
*/
|
|
||||||
public class MessageSendException extends TopIamException {
|
|
||||||
|
|
||||||
public MessageSendException(Throwable throwable) {
|
|
||||||
super(throwable, "message_send_error", "发送短信/邮件消息失败", HttpStatus.INTERNAL_SERVER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package cn.topiam.employee.common.exception;
|
package cn.topiam.employee.common.exception;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import cn.topiam.employee.support.exception.TopIamException;
|
import cn.topiam.employee.support.exception.TopIamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +28,15 @@ import cn.topiam.employee.support.exception.TopIamException;
|
||||||
* Created by support@topiam.cn on 2021/9/25 21:43
|
* Created by support@topiam.cn on 2021/9/25 21:43
|
||||||
*/
|
*/
|
||||||
public class MailMessageSendException extends TopIamException {
|
public class MailMessageSendException extends TopIamException {
|
||||||
|
|
||||||
|
public MailMessageSendException() {
|
||||||
|
super("message_send_error", "发送邮件消息失败", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MailMessageSendException(Throwable cause) {
|
||||||
|
super(cause, "message_send_error", "发送邮件消息失败", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new runtime exception with the specified detail message.
|
* Constructs a new runtime exception with the specified detail message.
|
||||||
* The cause is not initialized, and may subsequently be initialized by a
|
* The cause is not initialized, and may subsequently be initialized by a
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package cn.topiam.employee.common.exception;
|
package cn.topiam.employee.common.exception;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import cn.topiam.employee.support.exception.TopIamException;
|
import cn.topiam.employee.support.exception.TopIamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +28,14 @@ import cn.topiam.employee.support.exception.TopIamException;
|
||||||
* Created by support@topiam.cn on 2023/8/26 18:01
|
* Created by support@topiam.cn on 2023/8/26 18:01
|
||||||
*/
|
*/
|
||||||
public class SmsMessageSendException extends TopIamException {
|
public class SmsMessageSendException extends TopIamException {
|
||||||
|
public SmsMessageSendException() {
|
||||||
|
super("message_send_error", "发送短信消息失败", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmsMessageSendException(Throwable cause) {
|
||||||
|
super(cause, "message_send_error", "发送短信消息失败", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new runtime exception with the specified detail message.
|
* Constructs a new runtime exception with the specified detail message.
|
||||||
* The cause is not initialized, and may subsequently be initialized by a
|
* The cause is not initialized, and may subsequently be initialized by a
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -40,9 +40,6 @@ const QqOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.app_id.placeholder',
|
id: 'pages.authn.identity_provider.config.alipay_oauth.app_id.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.app_id.extra',
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
<ProFormText.Password
|
<ProFormText.Password
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
|
@ -53,9 +50,6 @@ const QqOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.app_private_key.placeholder',
|
id: 'pages.authn.identity_provider.config.alipay_oauth.app_private_key.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.app_private_key.extra',
|
|
||||||
})}
|
|
||||||
fieldProps={{ autoComplete: 'off' }}
|
fieldProps={{ autoComplete: 'off' }}
|
||||||
/>
|
/>
|
||||||
<ProFormText.Password
|
<ProFormText.Password
|
||||||
|
@ -67,9 +61,6 @@ const QqOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.placeholder',
|
id: 'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.extra',
|
|
||||||
})}
|
|
||||||
fieldProps={{ autoComplete: 'off' }}
|
fieldProps={{ autoComplete: 'off' }}
|
||||||
/>
|
/>
|
||||||
{!isCreate && <CallbackUrl />}
|
{!isCreate && <CallbackUrl />}
|
||||||
|
|
|
@ -40,9 +40,6 @@ const GiteeOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.gitee_oauth.client_id.placeholder',
|
id: 'pages.authn.identity_provider.config.gitee_oauth.client_id.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.gitee_oauth.client_id.extra',
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
<ProFormText.Password
|
<ProFormText.Password
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
|
@ -53,9 +50,6 @@ const GiteeOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.gitee_oauth.client_secret.placeholder',
|
id: 'pages.authn.identity_provider.config.gitee_oauth.client_secret.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.gitee_oauth.client_secret.extra',
|
|
||||||
})}
|
|
||||||
fieldProps={{ autoComplete: 'off' }}
|
fieldProps={{ autoComplete: 'off' }}
|
||||||
/>
|
/>
|
||||||
{!isCreate && <CallbackUrl />}
|
{!isCreate && <CallbackUrl />}
|
||||||
|
|
|
@ -40,9 +40,6 @@ const QqOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.github_oauth.client_id.placeholder',
|
id: 'pages.authn.identity_provider.config.github_oauth.client_id.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.github_oauth.client_id.extra',
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
<ProFormText.Password
|
<ProFormText.Password
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
|
@ -53,9 +50,6 @@ const QqOauthConfig = (props: { isCreate: boolean }) => {
|
||||||
placeholder={intl.formatMessage({
|
placeholder={intl.formatMessage({
|
||||||
id: 'pages.authn.identity_provider.config.github_oauth.client_secret.placeholder',
|
id: 'pages.authn.identity_provider.config.github_oauth.client_secret.placeholder',
|
||||||
})}
|
})}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.authn.identity_provider.config.github_oauth.client_secret.extra',
|
|
||||||
})}
|
|
||||||
fieldProps={{ autoComplete: 'off' }}
|
fieldProps={{ autoComplete: 'off' }}
|
||||||
/>
|
/>
|
||||||
{!isCreate && <CallbackUrl />}
|
{!isCreate && <CallbackUrl />}
|
||||||
|
|
|
@ -65,33 +65,19 @@ export default {
|
||||||
'pages.authn.identity_provider.config.gitee_oauth.client_secret': '客户端秘钥',
|
'pages.authn.identity_provider.config.gitee_oauth.client_secret': '客户端秘钥',
|
||||||
'pages.authn.identity_provider.config.gitee_oauth.client_secret.placeholder':
|
'pages.authn.identity_provider.config.gitee_oauth.client_secret.placeholder':
|
||||||
'请填写ClientSecret',
|
'请填写ClientSecret',
|
||||||
'pages.authn.identity_provider.config.gitee_oauth.client_id.extra': 'Gitee应用的Client ID',
|
'pages.authn.identity_provider.config.github_oauth.client_id': '客户端ID',
|
||||||
'pages.authn.identity_provider.config.gitee_oauth.client_secret.extra':
|
|
||||||
'Gitee应用生成的Client secret',
|
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_id':
|
|
||||||
'客户端ID',
|
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_id.placeholder': '请填写Client ID',
|
'pages.authn.identity_provider.config.github_oauth.client_id.placeholder': '请填写Client ID',
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_secret':
|
'pages.authn.identity_provider.config.github_oauth.client_secret': '客户端秘钥',
|
||||||
'客户端秘钥',
|
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_secret.placeholder':
|
'pages.authn.identity_provider.config.github_oauth.client_secret.placeholder':
|
||||||
'请填写Client Secret',
|
'请填写Client Secret',
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_id.extra': 'GitHub应用的Client ID',
|
|
||||||
'pages.authn.identity_provider.config.github_oauth.client_secret.extra':
|
|
||||||
'GitHub应用生成的Client secret',
|
|
||||||
|
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_id': '应用ID',
|
'pages.authn.identity_provider.config.alipay_oauth.app_id': '应用ID',
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_id.placeholder': '请填写应用ID',
|
'pages.authn.identity_provider.config.alipay_oauth.app_id.placeholder': '请填写应用ID',
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_id.extra': 'xxxxxxxxx',
|
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_id.placeholder.extra': 'xxxxxxx',
|
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_private_key': '应用私钥',
|
'pages.authn.identity_provider.config.alipay_oauth.app_private_key': '应用私钥',
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_private_key.placeholder':
|
'pages.authn.identity_provider.config.alipay_oauth.app_private_key.placeholder': '请填写应用私钥',
|
||||||
'请填写应用私钥',
|
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.app_private_key.extra': 'xxxxxxxxxxx',
|
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key': '支付宝公钥',
|
'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key': '支付宝公钥',
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.placeholder':
|
'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.placeholder':
|
||||||
'请填写支付宝公钥',
|
'请填写支付宝公钥',
|
||||||
'pages.authn.identity_provider.config.alipay_oauth.alipay_public_key.extra': 'xxxxxxxxxxxxx',
|
|
||||||
|
|
||||||
'pages.authn.identity_provider.config.wechat_scan_code.app_id.extra':
|
'pages.authn.identity_provider.config.wechat_scan_code.app_id.extra':
|
||||||
'微信扫码登录开发申请获取的AppId',
|
'微信扫码登录开发申请获取的AppId',
|
||||||
'pages.authn.identity_provider.config.wechat_scan_code.app_id.placeholder': '请填写获取的AppId',
|
'pages.authn.identity_provider.config.wechat_scan_code.app_id.placeholder': '请填写获取的AppId',
|
||||||
|
|
|
@ -42,7 +42,6 @@ import cn.topiam.employee.common.entity.setting.MailTemplateEntity;
|
||||||
import cn.topiam.employee.common.enums.MailType;
|
import cn.topiam.employee.common.enums.MailType;
|
||||||
import cn.topiam.employee.common.enums.MessageCategory;
|
import cn.topiam.employee.common.enums.MessageCategory;
|
||||||
import cn.topiam.employee.common.exception.MailMessageSendException;
|
import cn.topiam.employee.common.exception.MailMessageSendException;
|
||||||
import cn.topiam.employee.common.exception.MessageSendException;
|
|
||||||
import cn.topiam.employee.common.exception.SmsMessageSendException;
|
import cn.topiam.employee.common.exception.SmsMessageSendException;
|
||||||
import cn.topiam.employee.common.message.mail.MailNoneProviderSend;
|
import cn.topiam.employee.common.message.mail.MailNoneProviderSend;
|
||||||
import cn.topiam.employee.common.message.mail.MailProviderSend;
|
import cn.topiam.employee.common.message.mail.MailProviderSend;
|
||||||
|
@ -183,7 +182,7 @@ public class NoticeMessageListener extends AbstractMessageListener {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("发送短信消息异常 params:{}, error: {}", smsParam, e.getMessage());
|
log.error("发送短信消息异常 params:{}, error: {}", smsParam, e.getMessage());
|
||||||
throw new MessageSendException(e);
|
throw new SmsMessageSendException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +253,7 @@ public class NoticeMessageListener extends AbstractMessageListener {
|
||||||
mailSendRecordRepository.save(record);
|
mailSendRecordRepository.save(record);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("邮件信息发送失败: {}", e.getMessage());
|
log.error("邮件信息发送失败: {}", e.getMessage());
|
||||||
throw new MailMessageSendException("邮件信息发送失败!", e);
|
throw new MailMessageSendException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue