mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
feat: 不同类型 ACME 账号支持使用同一个邮箱 (#3344)
Refs https://github.com/1Panel-dev/1Panel/issues/3333
This commit is contained in:
parent
b2926019cf
commit
3fb5e523a8
@ -12,6 +12,7 @@ type IAcmeAccountRepo interface {
|
|||||||
Save(account model.WebsiteAcmeAccount) error
|
Save(account model.WebsiteAcmeAccount) error
|
||||||
DeleteBy(opts ...DBOption) error
|
DeleteBy(opts ...DBOption) error
|
||||||
WithEmail(email string) DBOption
|
WithEmail(email string) DBOption
|
||||||
|
WithType(acType string) DBOption
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIAcmeAccountRepo() IAcmeAccountRepo {
|
func NewIAcmeAccountRepo() IAcmeAccountRepo {
|
||||||
@ -26,6 +27,11 @@ func (w *WebsiteAcmeAccountRepo) WithEmail(email string) DBOption {
|
|||||||
return db.Where("email = ?", email)
|
return db.Where("email = ?", email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (w *WebsiteAcmeAccountRepo) WithType(acType string) DBOption {
|
||||||
|
return func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Where("type = ?", acType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (w *WebsiteAcmeAccountRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteAcmeAccount, error) {
|
func (w *WebsiteAcmeAccountRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteAcmeAccount, error) {
|
||||||
var accounts []model.WebsiteAcmeAccount
|
var accounts []model.WebsiteAcmeAccount
|
||||||
|
@ -35,7 +35,7 @@ func (w WebsiteAcmeAccountService) Page(search dto.PageInfo) (int64, []response.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w WebsiteAcmeAccountService) Create(create request.WebsiteAcmeAccountCreate) (*response.WebsiteAcmeAccountDTO, error) {
|
func (w WebsiteAcmeAccountService) Create(create request.WebsiteAcmeAccountCreate) (*response.WebsiteAcmeAccountDTO, error) {
|
||||||
exist, _ := websiteAcmeRepo.GetFirst(websiteAcmeRepo.WithEmail(create.Email))
|
exist, _ := websiteAcmeRepo.GetFirst(websiteAcmeRepo.WithEmail(create.Email), websiteAcmeRepo.WithType(create.Type))
|
||||||
if exist != nil {
|
if exist != nil {
|
||||||
return nil, buserr.New(constant.ErrEmailIsExist)
|
return nil, buserr.New(constant.ErrEmailIsExist)
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,12 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
:label="acme.email"
|
:label="acme.email"
|
||||||
:value="acme.id"
|
:value="acme.id"
|
||||||
></el-option>
|
>
|
||||||
|
<span>
|
||||||
|
{{ acme.email }}
|
||||||
|
<el-tag class="ml-5">{{ getAccountName(acme.type) }}</el-tag>
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('website.ssl')" prop="websiteSSLId" :hide-required-asterisk="true">
|
<el-form-item :label="$t('website.ssl')" prop="websiteSSLId" :hide-required-asterisk="true">
|
||||||
@ -162,7 +167,7 @@ import { ElMessageBox, FormInstance } from 'element-plus';
|
|||||||
import { computed, onMounted, reactive, ref } from 'vue';
|
import { computed, onMounted, reactive, ref } from 'vue';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import { dateFormatSimple, getProvider } from '@/utils/util';
|
import { dateFormatSimple, getProvider, getAccountName } from '@/utils/util';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import FileList from '@/components/file-list/index.vue';
|
import FileList from '@/components/file-list/index.vue';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user