diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 747e9d2..7181870 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -9,6 +9,9 @@ class SessionsController < ApplicationController return render :new end sign_in user + if session_params[:password] == Settings.default_password + flash[:warning] = t('terms.changeme_password') + end redirect_to root_path end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2e3392a..cab7d16 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -96,6 +96,7 @@
+ <%= render partial: "shared/flash" %> <% if content_for?(:page_head) %>
diff --git a/app/views/shared/_flash.html.haml b/app/views/shared/_flash.html.haml new file mode 100644 index 0000000..7974c60 --- /dev/null +++ b/app/views/shared/_flash.html.haml @@ -0,0 +1,5 @@ +.row + - if flash[:warning] + %p.alert.alert-warning + =raw flash[:warning] + diff --git a/config/application.yml b/config/application.yml index 283516c..940f654 100644 --- a/config/application.yml +++ b/config/application.yml @@ -1,4 +1,5 @@ defaults: &defaults + default_password: changeme recommended_plugins: - category: filter name: "rewrite-tag-filter" diff --git a/config/locales/translation_en.yml b/config/locales/translation_en.yml index 189f4a6..2283a89 100644 --- a/config/locales/translation_en.yml +++ b/config/locales/translation_en.yml @@ -27,6 +27,7 @@ en: installing: "Installing: %{target}" uninstalling: "Uninstalling: %{target}" search: Search + changeme_password: 'Change the password from default for your security' destroy_confirm_title: "%{target} Deletion" destroy_confirm_body: | Really delete? diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index 841e677..0beae2f 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -27,6 +27,7 @@ ja: installing: "インストール中: %{target}" uninstalling: "アンインストール中: %{target}" search: 検索 + changeme_password: 'パスワードを初期設定から変更してください' destroy_confirm_title: "%{target}を削除" destroy_confirm_body: | 削除しますか? diff --git a/db/seeds.rb b/db/seeds.rb index d0bf4c4..45bcc9c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,5 +7,5 @@ # Mayor.create(name: 'Emanuel', city: cities.first) unless User.exists? - User.create!(name: "admin", password: "changeme") + User.create!(name: "admin", password: Settings.default_password) end