-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Core): add query to return password requirements (#817)
- Loading branch information
1 parent
542f652
commit 8b8d5d9
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
type Config { | ||
""" | ||
List of requirements for the password. | ||
""" | ||
passwordRequirements: [String!] | ||
} | ||
|
||
extend type Query { | ||
""" | ||
Retrieves the configuration of the system. | ||
""" | ||
config: Config! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pathlib | ||
|
||
from ariadne import ( | ||
ObjectType, | ||
QueryType, | ||
load_schema_from_path, | ||
) | ||
from django.contrib.auth.password_validation import password_validators_help_texts | ||
|
||
config_type_defs = load_schema_from_path( | ||
f"{pathlib.Path(__file__).parent.resolve()}/graphql/schema.graphql" | ||
) | ||
|
||
config_object = ObjectType("Config") | ||
config_query = QueryType() | ||
|
||
|
||
@config_query.field("config") | ||
def resolve_config(_, info): | ||
return config_object | ||
|
||
|
||
@config_object.field("passwordRequirements") | ||
def resolve_config_password_requirements(_, info): | ||
return password_validators_help_texts() | ||
|
||
|
||
config_bindables = [config_query, config_object] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters