smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

can't be blank #371

Closed MattGaud2425 closed 6 years ago

MattGaud2425 commented 6 years ago

Processing with Coherence.RegistrationController.create/2 Parameters: %{"_csrf_token" => "Iho9FAlTES1jCwsZXVpyVxReRS4GAAAAFIUW15pN5FhvnbD5y13g7Q==", "_utf8" => "✓", "registration" => %{"email" => "quickhat22@Gmail.com", "name" => "quickhat22", "password" => "[FILTERED]", "password_confirmation" => "[FILTERED]"}}

registration processed but rendered error with can't be blank alerts above the email, password and password confirmation fields.

pradosh987 commented 6 years ago

I am having same problem. New version 0.5.1 kind of has breaking changes thats not documented anywhere. For ex. whats registration_permitted_attributes , in registration controller 'Controller.changeset always return empty struct.

openmosix commented 6 years ago

I had the same problem after upgrading. I got this fixed by adding:

registration_permitted_attributes: ["email","name","password","current_password","password_confirmation"]

to the config.exs of Coherence. I.e. full config is

config :coherence, user_schema: Test.Coherence.User, repo: Test.Repo, module: Test, web_module: TestWeb, router: TestWeb.Router, messages_backend: TestWeb.Coherence.Messages, logged_out_url: "/", user_active_field: true, email_from_name: "Test", email_from_email: "hello@test.net", opts: [:authenticatable, :recoverable, :trackable, :registerable, :confirmable, :rememberable] , registration_permitted_attributes: ["email","name","password","current_password","password_confirmation"]

smpallen99 commented 6 years ago

I'm sorry for the inconvenience. Yes, 0.5.1 introduced the permitted_attributes feature, requiring this configuration. This is a huge security improvement. I'm thinking of adding defaults so upgraded applications without the config will have a sensible default.

openmosix commented 6 years ago

@smpallen99 make sense! I think just mentioning in the doc (the new setting) should suffice for now. And btw - thanks a lot for running this project 👍

pradosh987 commented 6 years ago

@smpallen99 Also please consider adding changeling, even one liner would be enough. Anyways great job with this library.