snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 21:19:12 +05:00
commit c60cc7ca75
8092 changed files with 394160 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
import {
appPrefix,
assertVerifiableAddress,
gen,
parseHtml,
verifyHrefPattern,
} from "../../../../helpers"
import { routes as express } from "../../../../helpers/express"
import { routes as react } from "../../../../helpers/react"
context("Account Verification Registration Errors", () => {
;[
{
login: react.login,
verification: react.verification,
app: "react" as "react",
profile: "verification",
},
{
login: express.login,
verification: express.verification,
app: "express" as "express",
profile: "verification",
},
].forEach(({ profile, login, verification, app }) => {
describe(`for app ${app}`, () => {
before(() => {
cy.deleteMail()
cy.useConfigProfile(profile)
cy.proxy(app)
})
let identity
beforeEach(() => {
cy.useConfig((builder) =>
builder
.enableVerification()
.disableRecovery()
.shortCodeLifespan()
.longVerificationLifespan(),
)
cy.deleteMail()
identity = gen.identityWithWebsite()
cy.registerApi(identity)
cy.login(identity)
})
it("is unable to verify the email address if the code is no longer valid and resend the code", () => {
cy.verifyEmailButExpired({
expect: { email: identity.email },
})
cy.longCodeLifespan()
cy.visit(verification)
cy.get(appPrefix(app) + 'input[name="email"]').should("be.empty")
cy.get('input[name="email"]').type(identity.email)
cy.get('button[value="code"]').click()
cy.contains("An email containing a verification")
cy.verifyEmail({
expect: { email: identity.email, password: identity.password },
})
})
it("is unable to verify the email address if the code is incorrect", () => {
cy.getMail({
body: "Verify your account",
email: identity.email,
}).then((mail) => {
const link = parseHtml(mail.body).querySelector("a")
expect(verifyHrefPattern.test(link.href)).to.be.true
cy.visit(link.href + "-not") // add random stuff to the confirm challenge
cy.getSession().should((session) =>
assertVerifiableAddress({
isVerified: false,
email: identity.email,
})(session),
)
})
})
})
})
})

View File

@@ -0,0 +1,109 @@
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
import { assertVerifiableAddress, gen } from "../../../../helpers"
import { routes as react } from "../../../../helpers/react"
import { routes as express } from "../../../../helpers/express"
context("Account Verification Registration Success", () => {
;[
{
registration: react.registration,
app: "react" as "react",
profile: "verification",
},
{
registration: express.registration,
app: "express" as "express",
profile: "verification",
},
].forEach(({ profile, registration, app }) => {
describe(`for app ${app}`, () => {
before(() => {
cy.deleteMail()
cy.useConfigProfile(profile)
cy.proxy(app)
})
beforeEach(() => {
cy.useConfig((builder) => builder.longVerificationLifespan())
cy.deleteMail()
})
afterEach(() => {
cy.deleteMail()
})
const up = (value) => `up-${value}`
const { email, password } = gen.identity()
it("is able to verify the email address after sign up", () => {
const identity = gen.identityWithWebsite()
const { email, password } = identity
cy.registerApi(identity)
cy.login(identity)
cy.getSession().should((session) =>
assertVerifiableAddress({
isVerified: false,
email,
})(session),
)
cy.verifyEmail({ expect: { email, password } })
})
xit("sends the warning email on double sign up", () => {
// FIXME https://github.com/ory/kratos/issues/133
cy.clearAllCookies()
cy.register({ email, password: up(password) })
cy.clearAllCookies()
cy.login({ email, password })
cy.verifyEmail({ expect: { email, password } })
})
it("is redirected to after_verification_return_to after verification", () => {
cy.clearAllCookies()
const { email, password } = gen.identity()
cy.register({
email,
password,
query: {
return_to: "http://localhost:4455/verification_return_to_callback",
after_verification_return_to:
"http://localhost:4455/verification_callback",
},
})
cy.login({ email, password })
cy.verifyEmail({
expect: {
email,
password,
redirectTo: "http://localhost:4455/verification_callback",
},
})
})
it("is redirected to `return_to` after verification", () => {
cy.clearAllCookies()
const { email, password } = gen.identity()
cy.register({
email,
password,
query: {
return_to: "http://localhost:4455/verification_return_to_callback",
},
})
cy.login({ email, password })
cy.verifyEmail({
expect: {
email,
password,
redirectTo: "http://localhost:4455/verification_return_to_callback",
},
})
})
})
})
})