fix: SMTP config setup (#4272)

* fix: change default for SMTPSenderAddressMatchesInstanceDomain to false

* fix: handle error in console
This commit is contained in:
Livio Spring 2022-09-02 09:04:29 +02:00 committed by GitHub
parent 05f918ac83
commit bee616c11a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 27 deletions

View File

@ -361,7 +361,7 @@ DefaultInstance:
DomainPolicy: DomainPolicy:
UserLoginMustBeDomain: true UserLoginMustBeDomain: true
ValidateOrgDomains: true ValidateOrgDomains: true
SMTPSenderAddressMatchesInstanceDomain: true SMTPSenderAddressMatchesInstanceDomain: false
LoginPolicy: LoginPolicy:
AllowUsernamePassword: true AllowUsernamePassword: true
AllowRegister: true AllowRegister: true

View File

@ -5,10 +5,12 @@ import { take } from 'rxjs';
import { import {
AddSMSProviderTwilioRequest, AddSMSProviderTwilioRequest,
AddSMTPConfigRequest, AddSMTPConfigRequest,
AddSMTPConfigResponse,
UpdateSMSProviderTwilioRequest, UpdateSMSProviderTwilioRequest,
UpdateSMTPConfigPasswordRequest, UpdateSMTPConfigPasswordRequest,
UpdateSMTPConfigPasswordResponse, UpdateSMTPConfigPasswordResponse,
UpdateSMTPConfigRequest, UpdateSMTPConfigRequest,
UpdateSMTPConfigResponse,
} from 'src/app/proto/generated/zitadel/admin_pb'; } from 'src/app/proto/generated/zitadel/admin_pb';
import { DebugNotificationProvider, SMSProvider, SMSProviderConfigState } from 'src/app/proto/generated/zitadel/settings_pb'; import { DebugNotificationProvider, SMSProvider, SMSProviderConfigState } from 'src/app/proto/generated/zitadel/settings_pb';
import { AdminService } from 'src/app/services/admin.service'; import { AdminService } from 'src/app/services/admin.service';
@ -134,7 +136,7 @@ export class NotificationSettingsComponent implements OnInit {
}); });
} }
private updateData(): Promise<UpdateSMTPConfigPasswordResponse.AsObject> | any { private updateData(): Promise<UpdateSMTPConfigResponse.AsObject | AddSMTPConfigResponse> {
if (this.hasSMTPConfig) { if (this.hasSMTPConfig) {
const req = new UpdateSMTPConfigRequest(); const req = new UpdateSMTPConfigRequest();
req.setHost(this.host?.value ?? ''); req.setHost(this.host?.value ?? '');
@ -143,9 +145,7 @@ export class NotificationSettingsComponent implements OnInit {
req.setTls(this.tls?.value ?? false); req.setTls(this.tls?.value ?? false);
req.setUser(this.user?.value ?? ''); req.setUser(this.user?.value ?? '');
return this.service.updateSMTPConfig(req).catch((error) => { return this.service.updateSMTPConfig(req);
this.toast.showError(error);
});
} else { } else {
const req = new AddSMTPConfigRequest(); const req = new AddSMTPConfigRequest();
req.setHost(this.host?.value ?? ''); req.setHost(this.host?.value ?? '');
@ -154,16 +154,12 @@ export class NotificationSettingsComponent implements OnInit {
req.setTls(this.tls?.value ?? false); req.setTls(this.tls?.value ?? false);
req.setUser(this.user?.value ?? ''); req.setUser(this.user?.value ?? '');
return this.service.addSMTPConfig(req).catch((error) => { return this.service.addSMTPConfig(req);
this.toast.showError(error);
});
} }
} }
public savePolicy(): void { public savePolicy(): void {
const prom = this.updateData(); this.updateData()
if (prom) {
prom
.then(() => { .then(() => {
this.toast.showInfo('SETTING.SMTP.SAVED', true); this.toast.showInfo('SETTING.SMTP.SAVED', true);
setTimeout(() => { setTimeout(() => {
@ -174,7 +170,6 @@ export class NotificationSettingsComponent implements OnInit {
this.toast.showError(error); this.toast.showError(error);
}); });
} }
}
public editSMSProvider(): void { public editSMSProvider(): void {
const dialogRef = this.dialog.open(DialogAddSMSProviderComponent, { const dialogRef = this.dialog.open(DialogAddSMSProviderComponent, {