#103 ✓moved_to_github
José Valim

add on option to magic states

Reported by José Valim | May 2nd, 2009 @ 04:43 PM

Hey Ben,

I'm building an application which when the user changes his e-mail by updating his account, another confirmation e-mail is sent and the account is marked as not confirmed.

Since magic states validation on session always occurs, the user is logged out right after he changes his e-mail.

I disabled the validation in my case and replaced by custom validations, but would be nice to have a option in magic states where I could say if the validation should occur on save, create or update, like on AR:

validate :validate_magic_states, :on => :create

Regards.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson May 4th, 2009 @ 12:02 AM

    • State changed from “new” to “open”

    I see what you are saying. That module has been in authlogic since day 1, and to be honest, I feel like it performs such an easy task that its really not necessary to have in the core. Obviously, at this point I can't remove it, and it doesn't hurt to have it. You could disable magic states and just roll your own. Something like:

    validate :validate_confirmation, :if => :new_record?
    
    private
    def validate_confirmation
    errors.add_to_base("Your account is not confirmed")
    end
    

    Obviously this isn't the greatest solution in the world, but it can get you by until I release a better solution.

    What if I added in the validations configuration for magic states, like I have for the login field, email field, etc. Then you could specify your own options.

  • Ben Johnson

    Ben Johnson May 11th, 2009 @ 02:02 PM

    • State changed from “open” to “resolved”
  • José Valim

    José Valim May 12th, 2009 @ 02:43 AM

    Ben,

    You changed the state to resolved but I can't actually see any commit. Is this going to be on a recent release?

    Thanks!

  • Ben Johnson

    Ben Johnson May 12th, 2009 @ 02:45 AM

    • State changed from “resolved” to “open”

    I assumed the above was working for you. I'll reopen and give this some more thought and try to implement the :on feature.

  • José Valim

    José Valim May 12th, 2009 @ 02:47 AM

    I haven't tried the above yet. As soon as I do, I will let you know.

  • Ben Johnson

    Ben Johnson August 7th, 2009 @ 06:20 PM

    • State changed from “open” to “moved_to_github”

    [state:"moved_to_github" bulk edit command]

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

Attachments

Pages