Skip to content
Browse files

Set default password from the configuration.

  • Loading branch information...
1 parent ed52dd1 commit eec2a158d441a1443526f3fa2d8e606a1af289b9 Francesc Esplugas committed Feb 13, 2010
Showing with 5 additions and 4 deletions.
  1. +3 −4 app/controllers/typus_controller.rb
  2. +1 −0 lib/typus/configuration.rb
  3. +1 −0 test/lib/configuration_test.rb
View
7 app/controllers/typus_controller.rb
@@ -101,16 +101,15 @@ def sign_up
if request.post?
- password = "columbia"
-
user = Typus.user_class.generate(:email => params[:typus_user][:email],
- :password => password,
+ :password => Typus::Configuration.options[:default_password],
:role => Typus::Configuration.options[:root])
user.status = true
if user.save
session[:typus_user_id] = user.id
- flash[:notice] = _("Password set to \"{{password}}\".", :password => password)
+ flash[:notice] = _("Password set to \"{{password}}\".",
+ :password => Typus::Configuration.options[:default_password])
redirect_to admin_dashboard_path
else
flash[:error] = _("That doesn't seem like a valid email address.")
View
1 lib/typus/configuration.rb
@@ -5,6 +5,7 @@ module Configuration
# Default options which can be overwritten from the initializer.
typus_options = { :app_name => 'Typus',
:config_folder => 'config/typus',
+ :default_password => "columbia",
:email => nil,
:file_preview => :typus_preview,
:file_thumbnail => :typus_thumbnail,
View
1 test/lib/configuration_test.rb
@@ -11,6 +11,7 @@ def test_should_verify_application_wide_configuration_options
return if File.exist?(initializer)
assert_equal 'Typus', Typus::Configuration.options[:app_name]
assert_equal 'vendor/plugins/typus/test/config/working', Typus::Configuration.options[:config_folder]
+ assert_equal "columbia", Typus::Configuration.options[:default_password]
assert_equal nil, Typus::Configuration.options[:email]
assert_equal :typus_preview, Typus::Configuration.options[:file_preview]
assert_equal :typus_thumbnail, Typus::Configuration.options[:file_thumbnail]

0 comments on commit eec2a15

Please sign in to comment.
Something went wrong with that request. Please try again.