[Rails] Salted Login Generated code throwing lots of errors

David Barrett
2005-12-31T01:57:37Z

Hi,

I''m having a lot of problems while integrating the salted login
generator. All of the errors are of the form:
"The error occured while evaluating nil.[]"

Most seem to be down to evaluating a nested hash, where the first hash
is a nil object. For example,
@params[''user''][''login''] where
@params[''user''] returns the nil object. This method in
particular is
annoying me:

   def login
     generate_blank
     @user = User.new(@params[''user''])
     if @session[''user''] =
User.authenticate(@params[''user''][''login''],
@params[''user''][''password''])
       flash[''notice''] = l(:user_login_succeeded)
       redirect_back_or_default :action => ''welcome''
     else
       @login = @params[''user''][''login'']
       flash.now[''message''] = l(:user_login_failed)
     end
   end

This craps out on the line:
     if @session[''user''] =
User.authenticate(@params[''user''][''login''],
@params[''user''][''password''])
and the line:
       @login = @params[''user''][''login'']

Is there any way I can fix this problem without a lot of dull re-coding?

I''m using the Rails 0.14.4 and salted_login_generator 1.1.1

Dave

--
Site: http://antidis.com/