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:
UserLoginMustBeDomain: true
ValidateOrgDomains: true
SMTPSenderAddressMatchesInstanceDomain: true
SMTPSenderAddressMatchesInstanceDomain: false
LoginPolicy:
AllowUsernamePassword: true
AllowRegister: true

View File

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