In Gramex, for signup we have a validate method which will validate for a certain condition. Like in this example like we are validating the signup using validate()
function.:
signup:
key: signup # ?signup= is used as the signup parameter
template: $YAMLPATH/signup.html # Use this signup template
columns: # Mapping of URL query parameters to database columns
name: user_name # ?name= is saved in the user_name column
gender: user_gender # ?gender= is saved in the user_gender column
# Other than email, all other columns are ignored
validate: app.validate(args)
Similarly, is there a way to validate a condition in login mechanism? I can check manually but looking for a more feasible solution.
You can use
condition
kwarg
inauth
Ref: https://gramener.com/gramex/guide/auth/#api-key
For example: