riverrun / openmaize

No longer maintained - was an Authentication library for Plug-based applications in Elixir
Other
206 stars 30 forks source link

Add the ability to change field name of scheme #20

Closed kzkin closed 8 years ago

kzkin commented 8 years ago

Change "password_hash" field name in scheme through config

riverrun commented 8 years ago

Could you tell me why you want this change? It seems to add unnecessary complexity to the Login module.

kzkin commented 8 years ago

I want to use database used in rails project (devise scheme). Maybe there's another way ?

riverrun commented 8 years ago

What do you want to change it to?

mutablestate commented 8 years ago

@riverrun this is probably the devise schema @KozakIvan is using https://github.com/plataformatec/devise/blob/master/test/rails_app/db/schema.rb

kzkin commented 8 years ago

Yes, i'm using default devise schema. It is possible to setup password field name through config openmaize, same as in schema. Sorry for my english.

riverrun commented 8 years ago

I might add an option to allow you to use "encrypted_password" as well as "password_hash". It should be ready in 2 or 3 days' time.

riverrun commented 8 years ago

In the current master branch, there is now an option to change this in the config. Just add the following line to your config file (if you're using encrypted_password instead of password_hash):

hash_name: :encrypted_password

Make sure that you remember the : before encrypted_password.

kzkin commented 8 years ago

Thanks for your attention and time. Works like a charm. Little note that hash_name must equal field name of password in schema (database), maybe specify about that in documentation ? Otherwise, in my opinion, there is a difficult to diagnose error.

riverrun commented 8 years ago

You're right. I need to update the documentation. I'll let you know when I update the hex package.