mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 22:08:46 +00:00
feat(console): MDC components (#6482)
mdc components --------- Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
co-authored by
Elio Bischof
parent
cb7b50b513
commit
b099a26a16
@@ -0,0 +1,31 @@
|
||||
export function authenticate(
|
||||
loginUrl: string,
|
||||
creds: {
|
||||
password: any;
|
||||
username: string;
|
||||
},
|
||||
onUsernameScreen: () => void,
|
||||
onPasswordScreen: () => void,
|
||||
onAuthenticated: () => void,
|
||||
) {
|
||||
onUsernameScreen ? onUsernameScreen() : null;
|
||||
cy.get('#loginName').type(creds.username);
|
||||
cy.get('#submit-button').click();
|
||||
|
||||
onPasswordScreen ? onPasswordScreen() : null;
|
||||
cy.get('#password').type(creds.password);
|
||||
cy.get('#submit-button').click();
|
||||
|
||||
cy.wait('@password').then((interception) => {
|
||||
if (interception.response.body.indexOf(`${loginUrl}/mfa/prompt`) === -1) {
|
||||
return;
|
||||
}
|
||||
cy.contains('button', 'skip').click();
|
||||
});
|
||||
|
||||
cy.wait('@token');
|
||||
|
||||
onAuthenticated ? onAuthenticated() : null;
|
||||
|
||||
cy.wait(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user