> BTW, I have been looking at how to set in authlogic the configuration > so when a new user is created he/she does not get automatically signed > on and I couldn't find a way to do it yet. In my app. the admin is the > one creating users, the users don't register, so that functionality > must be handled by the application. If anybody can help it would be > appreciated.
In case it helps anybody, I believe I just found out how to do this. In my user model: acts_as_authentic do |c| c.maintain_sessions = false end > > Thank you > > On Jun 4, 7:15 am, Albus Dumbledore <[email protected]> wrote: > > > Hi there! > > > I know what I am trying to do would seem laughably easy to some, but > > pray accept my excuses for still being nothing more than a newbie where > > rails is concerned. It seems there is so much to learn. And with rails > > it's always not about doing it, but doing it easily and meaningfully, > > i.e. I'm asking how to do it the RIGHT way. > > > Now, I am having a very simple User/Session model (implemented using > > Authlogic). In fact it is so simple, that all the functionality > > regarding profile editing is put on ONE page. I'd like the user to be > > able to set some details AND to be able to change their password. In > > case the user desires to change their password, i.e. does NOT leave the > > password field blank, they must be required to enter their current > > password (sounds logical enough to me) in another field. > > > However, there are a couple of problems I am experiencing with this > > simple scenario. > > > Firstly, how could I tell the User model to forget about the password > > fields and NOT save them if they are empty (I know how to validate them > > but that alone doesn't seem to do it) and so Authologic wouldn't > > complain either? > > > Secondly, is there any way to validate that the entered password in the > > `password_check` field matches the current one, but do it using custom > > validation callbacks (i.e. in the model, not in the controller)? I don't > > see how one could have access to the params hash from within the model > > validation methods (and it doesn't seems right to me to do so) so should > > one use virtual attributes to do the check?! > > > Thirdly, even if all that validation was done in the controller (i.e. if > > it is not possible to be done in the model), does anyone know how I am > > to compare the entered password and the current one for it is stored in > > encrypted form. There must be some method in Authologic that should be > > able to do just that (i.e. not reviling the password, but comparing an > > entered password against the current one). > > > And finally, is there any way to add errors to an ActiveRecord object > > from within the controller (not the model) so as to be able to show them > > along with the other validation errors if I can't make that validation > > in the model? > > > Thank you awfully much! > > > ...and sorry for the bunch of words but it's incredibly hard to express > > extremely simple things simply. > > -- > > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

