Skip to content

Commit

Permalink
style: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Benehiko committed Jul 25, 2023
1 parent e51d791 commit 5c5d4c3
Show file tree
Hide file tree
Showing 5 changed files with 547 additions and 499 deletions.
1 change: 1 addition & 0 deletions selfservice/strategy/code/code_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/gofrs/uuid"

"github.com/ory/kratos/identity"
)

Expand Down
3 changes: 2 additions & 1 deletion selfservice/strategy/code/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"encoding/json"
"net/http"

"github.com/pkg/errors"

"github.com/ory/kratos/continuity"
"github.com/ory/kratos/courier"
"github.com/ory/kratos/driver/config"
Expand All @@ -29,7 +31,6 @@ import (
"github.com/ory/x/decoderx"
"github.com/ory/x/randx"
"github.com/ory/x/urlx"
"github.com/pkg/errors"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ context("Registration success with code method", () => {
route: react.registration,
app: "react" as "react",
profile: "code",
}
},
].forEach(({ route, profile, app }) => {
describe(`for app ${app}`, () => {
before(() => {
Expand Down Expand Up @@ -64,8 +64,6 @@ context("Registration success with code method", () => {
expect(identity.traits.tos).to.equal(true)
})
})

})

})
})
59 changes: 29 additions & 30 deletions test/e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Cypress.Commands.add("proxy", (app: string) => {
})
})

Cypress.Commands.add("shortPrivilegedSessionTime", ({ } = {}) => {
Cypress.Commands.add("shortPrivilegedSessionTime", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.settings.privileged_session_max_age = "1ms"
return config
Expand Down Expand Up @@ -109,50 +109,50 @@ Cypress.Commands.add("setDefaultIdentitySchema", (id: string) => {
})
})

Cypress.Commands.add("longPrivilegedSessionTime", ({ } = {}) => {
Cypress.Commands.add("longPrivilegedSessionTime", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.settings.privileged_session_max_age = "5m"
return config
})
})
Cypress.Commands.add("longVerificationLifespan", ({ } = {}) => {
Cypress.Commands.add("longVerificationLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.verification.lifespan = "1m"
return config
})
})
Cypress.Commands.add("shortVerificationLifespan", ({ } = {}) => {
Cypress.Commands.add("shortVerificationLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.verification.lifespan = "1ms"
return config
})
})
Cypress.Commands.add("sessionRequiresNo2fa", ({ } = {}) => {
Cypress.Commands.add("sessionRequiresNo2fa", ({} = {}) => {
updateConfigFile((config) => {
config.session.whoami.required_aal = "aal1"
return config
})
})
Cypress.Commands.add("sessionRequires2fa", ({ } = {}) => {
Cypress.Commands.add("sessionRequires2fa", ({} = {}) => {
updateConfigFile((config) => {
config.session.whoami.required_aal = "highest_available"
return config
})
})
Cypress.Commands.add("shortLinkLifespan", ({ } = {}) => {
Cypress.Commands.add("shortLinkLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.link.config.lifespan = "1ms"
return config
})
})
Cypress.Commands.add("longLinkLifespan", ({ } = {}) => {
Cypress.Commands.add("longLinkLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.link.config.lifespan = "1m"
return config
})
})

Cypress.Commands.add("shortCodeLifespan", ({ } = {}) => {
Cypress.Commands.add("shortCodeLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.code.config.lifespan = "1ms"
return config
Expand All @@ -173,28 +173,28 @@ Cypress.Commands.add("longLifespan", (strategy: Strategy) => {
})
})

Cypress.Commands.add("longCodeLifespan", ({ } = {}) => {
Cypress.Commands.add("longCodeLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.code.config.lifespan = "1m"
return config
})
})

Cypress.Commands.add("shortCodeLifespan", ({ } = {}) => {
Cypress.Commands.add("shortCodeLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.code.config.lifespan = "1ms"
return config
})
})

Cypress.Commands.add("longCodeLifespan", ({ } = {}) => {
Cypress.Commands.add("longCodeLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.methods.code.config.lifespan = "1m"
return config
})
})

Cypress.Commands.add("longRecoveryLifespan", ({ } = {}) => {
Cypress.Commands.add("longRecoveryLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.recovery.lifespan = "1m"
return config
Expand All @@ -221,20 +221,20 @@ Cypress.Commands.add("setPostPasswordRegistrationHooks", (hooks) => {
cy.setupHooks("registration", "after", "password", hooks)
})

Cypress.Commands.add("shortLoginLifespan", ({ } = {}) => {
Cypress.Commands.add("shortLoginLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.login.lifespan = "100ms"
return config
})
})
Cypress.Commands.add("longLoginLifespan", ({ } = {}) => {
Cypress.Commands.add("longLoginLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.login.lifespan = "1h"
return config
})
})

Cypress.Commands.add("shortRecoveryLifespan", ({ } = {}) => {
Cypress.Commands.add("shortRecoveryLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.recovery.lifespan = "1ms"
return config
Expand All @@ -249,29 +249,29 @@ Cypress.Commands.add("requireStrictAal", () => {
})
})

Cypress.Commands.add("useLaxAal", ({ } = {}) => {
Cypress.Commands.add("useLaxAal", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.settings.required_aal = "aal1"
config.session.whoami.required_aal = "aal1"
return config
})
})

Cypress.Commands.add("disableVerification", ({ } = {}) => {
Cypress.Commands.add("disableVerification", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.verification.enabled = false
return config
})
})

Cypress.Commands.add("enableVerification", ({ } = {}) => {
Cypress.Commands.add("enableVerification", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.verification.enabled = true
return config
})
})

Cypress.Commands.add("enableRecovery", ({ } = {}) => {
Cypress.Commands.add("enableRecovery", ({} = {}) => {
updateConfigFile((config) => {
if (!config.selfservice.flows.recovery) {
config.selfservice.flows.recovery = {}
Expand Down Expand Up @@ -302,28 +302,28 @@ Cypress.Commands.add("disableRecoveryStrategy", (strategy: Strategy) => {
})
})

Cypress.Commands.add("disableRecovery", ({ } = {}) => {
Cypress.Commands.add("disableRecovery", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.recovery.enabled = false
return config
})
})

Cypress.Commands.add("disableRegistration", ({ } = {}) => {
Cypress.Commands.add("disableRegistration", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.registration.enabled = false
return config
})
})

Cypress.Commands.add("enableRegistration", ({ } = {}) => {
Cypress.Commands.add("enableRegistration", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.registration.enabled = true
return config
})
})

Cypress.Commands.add("useLaxAal", ({ } = {}) => {
Cypress.Commands.add("useLaxAal", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.settings.required_aal = "aal1"
config.session.whoami.required_aal = "aal1"
Expand Down Expand Up @@ -655,21 +655,21 @@ Cypress.Commands.add(
},
)

Cypress.Commands.add("shortRegisterLifespan", ({ } = {}) => {
Cypress.Commands.add("shortRegisterLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.registration.lifespan = "100ms"
return config
})
})

Cypress.Commands.add("longRegisterLifespan", ({ } = {}) => {
Cypress.Commands.add("longRegisterLifespan", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.flows.registration.lifespan = "1h"
return config
})
})

Cypress.Commands.add("browserReturnUrlOry", ({ } = {}) => {
Cypress.Commands.add("browserReturnUrlOry", ({} = {}) => {
updateConfigFile((config) => {
config.selfservice.allowed_return_urls = [
"https://www.ory.sh/",
Expand All @@ -679,7 +679,7 @@ Cypress.Commands.add("browserReturnUrlOry", ({ } = {}) => {
})
})

Cypress.Commands.add("remoteCourierRecoveryTemplates", ({ } = {}) => {
Cypress.Commands.add("remoteCourierRecoveryTemplates", ({} = {}) => {
updateConfigFile((config) => {
config.courier.templates = {
recovery: {
Expand Down Expand Up @@ -709,7 +709,7 @@ Cypress.Commands.add("remoteCourierRecoveryTemplates", ({ } = {}) => {
})
})

Cypress.Commands.add("remoteCourierRecoveryCodeTemplates", ({ } = {}) => {
Cypress.Commands.add("remoteCourierRecoveryCodeTemplates", ({} = {}) => {
updateConfigFile((config) => {
config.courier.templates = {
recovery_code: {
Expand Down Expand Up @@ -1402,4 +1402,3 @@ Cypress.Commands.add("getRegistrationCodeFromEmail", (email) => {
return code
})
})

Loading

0 comments on commit 5c5d4c3

Please sign in to comment.