Custom registration form with Yesod.Auth.Email

Viewed 223

I have a question regarding why Yesod.Auth was done the way it was. I was trying to create a custom register form - i.e: more fields other than just email - and here are the issues I've encoutered along the way:

  1. I tried to create customized versions of functions defined in the Email module to render customized templates: defaultEmailLoginHandler, defaultRegisterHandler, defaultForgotPasswordHandler.

And it kept me wondering: why we can't simply provide a custom hamlet file and be done with it? Why do I have to create custom versions of those functions?

  1. After the template part was done I moved to processing the forms, and here I hit the wall. I tried to create a custom version of the registerHelper function but, that is not a visible member of the Yesod.Auth.Email class so, creating a custom registerHelper won't work. Then I thought I could provide a custom route to process the form by rewriting postRegisterR and again I was out of luck.

Why those functions, particularly registerHelper, were not created as visible members of Yesod.Auth.Email?

  1. My third attempt would be to "fork" the whole Email.hs module, but again I failed to meet some requirements to make this possible. In this case was the Yesod.PasswordStore that is not an exposed module, so I cannot import it into my custom Yesod.Auth.Email.

Why Yesod.PasswordStore was not exposed?

Given I don't want to go deeper into the rabbit hole and rewrite fork the PasswordStore, I just came to realize that it is not possible to have a custom registration form using Yesod.Auth.Email.

Am I missing something here or I got this right? Why Yesod.Auth.Email was built in that way?

1 Answers
Related