Closed suryaxan closed 3 years ago
Hi @suryaxan, loooks like a devise
related question.
Have you tried overwriting confirmation_required in your resource model?
To be active for auth
a model usually needs these 3 things
def active_for_authentication?
super && (!confirmation_required? || confirmed? || confirmation_period_valid?)
end
https://github.com/heartcombo/devise/blob/master/lib/devise/models/confirmable.rb#L106
Hi @00dav00, thanks for the quick response.
This is exactly what I missed. Thank you so much, this fixed my problem.
Question
Hello!
I have the following use case:
Note: I have implemented custom sign up and everything is working fine to sign up a user with either email/phone, so I am not posting any code related to that.
To implement custom login, I have done the following: -> Added a custom Login mutation and inherited from
GraphqlDevise::Mutations::Login
-> Updated the mount options in my custom graphql_schema file to use custom login mutation for theLogin
operationcustom_schema.rb looks like this
Mutations::Login looks like this
So, in my custom login mutation, when I try to
controller.sign_in(:user, resource, store: false, bypass: false)
, it throws401 Unauthorized
To understand the issue, I tried checking what is happening in
controller.sign_in
, I found that when I try login mutation with phone and otp, only the user records with email verified are going through, but for those user records which do not have email, the sign_in fails.In my use case, there is a chance that email is blank. User signs up with only phone number, is there a way I can sign in the user who has only phone number?