#25 ✓resolved
scottnj

configure/disable "login not confirmed/exist" methods

Reported by scottnj | January 6th, 2009 @ 12:29 AM

I have an app setup allowing users to log in by entering their username or email. To do this, my user model overwrites the find_by_login method. Something similar to this.


class User < ActiveRecord::Base
  acts_as_authentic
  def self.find_by_login(login)
    find_by_username(login) || find_by_email(login)
  end
  def confirmed?
    false
  end
end

When a user tries logging in to a !confirmed? account with their username they get "Your account is not confirmed" which is correct. But when they try logging in with an email they get "Login does not exist" which is not correct.

I tried finding where in your code these errors get applied but only found where I can set the text of the error messages.

Is there a way to edit the code to allow the "not confirmed" error message to be applied to multiple fields?

If not, can I just overwrite the method/validation, if so, how?

Another option could be adding a setting to disable the messages so we can simply add errors.add("login","...") into our own code.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson January 6th, 2009 @ 12:34 AM

    • State changed from “new” to “open”

    That doesnt make sense, because it first try and find the record, once the record if found it will call the confirmed? method to see if it is valid. So the error message is correct, the email you are searching is not being found. Can you debug that find_by_login method and confirm that a record is in fact being found by the email address passed?

  • scottnj

    scottnj January 6th, 2009 @ 12:56 AM

    you were right, there was an error in my find statement (not related to the example code above).

    i am still unsuccessful in trying to find any bugs in your plugin :-)

    thanks, scott

  • Ben Johnson

    Ben Johnson January 6th, 2009 @ 02:13 AM

    • State changed from “open” to “resolved”

    no problem, thanks for the update

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.

People watching this ticket

Pages