Skip to content

Commit

Permalink
fix(password): schema regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 7, 2022
1 parent 8a51839 commit 271d5fa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
63 changes: 40 additions & 23 deletions selfservice/strategy/password/.schema/login.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"$id": "https://schemas.ory.sh/kratos/selfservice/strategy/password/login.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"password",
"method"
],
"properties": {
"csrf_token": {
"type": "string"
Expand All @@ -22,25 +18,46 @@
"type": "string"
}
},
"if": {
"properties": {
"password_identifier": {
"type": "string",
"minLength": 1
"allOf": [
{
"if": {
"properties": {
"method": {
"const": "password"
}
},
"required": [
"method"
]
},
"then": {
"required": [
"password"
]
}
},
"required": [
"password_identifier"
]
},
"then": {
"required": [
"password_identifier"
]
},
"else": {
"required": [
"identifier"
]
}
{
"if": {
"properties": {
"password_identifier": {
"type": "string",
"minLength": 1
}
},
"required": [
"password_identifier"
]
},
"then": {
"required": [
"password_identifier"
]
},
"else": {
"required": [
"identifier"
]
}
}
]
}
1 change: 1 addition & 0 deletions selfservice/strategy/password/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ func TestCompleteLogin(t *testing.T) {

var values = func(v url.Values) {
v.Del("identifier")
v.Set("method", identity.CredentialsTypePassword.String())
v.Set("password", "password")
}

Expand Down

0 comments on commit 271d5fa

Please sign in to comment.