Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

lookup additional fields #52

Closed
shishi opened this issue Aug 14, 2016 · 6 comments
Closed

lookup additional fields #52

shishi opened this issue Aug 14, 2016 · 6 comments

Comments

@shishi
Copy link
Contributor

shishi commented Aug 14, 2016

In Readme, I found Monban can lookup multiple field (email or username). But I want to add required field for user lookup.
For example, User class has username, additional_field and password. username and additional_field are composite unique.

I found FieldMap class and I think I need to overwrite query_string or authenticate_session. Do you have any good idea?

@halogenandtoast
Copy link
Owner

What do you mean by "username and additional_field are composite unique" and how does this affect lookup?

@shishi
Copy link
Contributor Author

shishi commented Aug 18, 2016

I mean I want username is not unique and I do not have unique filed, so I need additional filed for finding user.

@halogenandtoast
Copy link
Owner

@shishi just for clarification have you tried just calling authenticate_session(session_params) with both fields. I don't see anything in the code that would prevent this from working.

@halogenandtoast
Copy link
Owner

@shishi, where session params is in the format:

{
  password: "foo",
  username: "bar",
  additional_field: "baz"
}

@halogenandtoast
Copy link
Owner

You should probably also configure the user_lookup_field to be id instead of email:

config.user_lookup_field = :id

This is used by Warden

@shishi
Copy link
Contributor Author

shishi commented Aug 22, 2016

I totally make an unwarranted assumption about Monban lookup user with single field.
I re-read FieldMap, params_with_symbolized_keys generate hash with passed all field without token...
I am so sorry worthless issue.

@shishi shishi closed this as completed Aug 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants