mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +00:00
feat: allow usernames without @ when UserMustBeDomain false (#4852)
* feat: allow usernames without @ when UserMustBeDomain false * e2e * test(e2e): table driven tests for humans and machines * cleanup * fix(e2e): ensure there are no username conflicts * e2e: make awaitDesired async * rm settings mapping * e2e: make awaitDesired async * e2e: parse sequence as int * e2e: ensure test fails if awaitDesired fails Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { requestHeaders } from './apiauth';
|
||||
import { API } from './types';
|
||||
import { ensureSetting } from './ensure';
|
||||
|
||||
export enum Policy {
|
||||
Label = 'label',
|
||||
@@ -15,3 +16,38 @@ export function resetPolicy(api: API, policy: Policy) {
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
export function ensureDomainPolicy(
|
||||
api: API,
|
||||
userLoginMustBeDomain: boolean,
|
||||
validateOrgDomains: boolean,
|
||||
smtpSenderAddressMatchesInstanceDomain: boolean,
|
||||
): Cypress.Chainable<number> {
|
||||
return ensureSetting(
|
||||
api,
|
||||
`${api.adminBaseURL}/policies/domain`,
|
||||
(body: any) => {
|
||||
const result = {
|
||||
sequence: parseInt(<string>body.policy?.details?.sequence),
|
||||
id: body.policy?.details?.resourceOwner,
|
||||
entity: null,
|
||||
};
|
||||
if (
|
||||
body.policy &&
|
||||
(body.policy.userLoginMustBeDomain ? body.policy.userLoginMustBeDomain : false) == userLoginMustBeDomain &&
|
||||
(body.policy.validateOrgDomains ? body.policy.validateOrgDomains : false) == validateOrgDomains &&
|
||||
(body.policy.smtpSenderAddressMatchesInstanceDomain ? body.policy.smtpSenderAddressMatchesInstanceDomain : false) ==
|
||||
smtpSenderAddressMatchesInstanceDomain
|
||||
) {
|
||||
return { ...result, entity: body.policy };
|
||||
}
|
||||
return result;
|
||||
},
|
||||
`${api.adminBaseURL}/policies/domain`,
|
||||
{
|
||||
userLoginMustBeDomain: userLoginMustBeDomain,
|
||||
validateOrgDomains: validateOrgDomains,
|
||||
smtpSenderAddressMatchesInstanceDomain: smtpSenderAddressMatchesInstanceDomain,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user