ruby on rails - where to store password besides database -
i'm trying build super simple authentication. i'm not sure store admin password. should put password? model, environment or somewhere else.? , how can access enviroment variable if store in environment. thanks!
update:
i put somethin in environment.rb
admin_password = "blablabla"
and trying authenticate
def authenticate(username, password) password = digest::md5.hexdigest(password).to_s if username == "admin" && password == env["admin_password"] session[:login] = true end end
not working...
i think no need to_s. all.
i'd prefer storing in environment variables if database not option.
you can access them like
env["db_password"] # => "something_random"
Comments
Post a Comment