diff --git a/Gemfile b/Gemfile index 34426427..dff74f62 100644 --- a/Gemfile +++ b/Gemfile @@ -54,8 +54,9 @@ gem 'couch_potato' , github: 'bterkuile/couch_potato' #gem 'simply_stored', path: './../components/simply_stored' #, github: 'bterkuile/simply_stored' gem 'simply_stored', github: 'bterkuile/simply_stored' #gem 'orm_adapter', github: 'bterkuile/orm_adapter' -gem 'devise', github: 'plataformatec/devise', branch: 'lm-rails-4-2' #, '3.1.0' #, '2.0.4' +gem 'devise' #, github: 'plataformatec/devise', branch: 'lm-rails-4-2' #, '3.1.0' #, '2.0.4' gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored' +gem 'devise-i18n' gem "omniauth-facebook" gem "omniauth-instagram" #gem 'simple_form' diff --git a/Gemfile.lock b/Gemfile.lock index 1ec6013c..844cd3c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,19 +43,6 @@ GIT ember_script (>= 0.0.4) rails -GIT - remote: git://github.com/plataformatec/devise.git - revision: 1d8890b77372b9c4fd3ec8e9b4963d76774ed33c - branch: lm-rails-4-2 - specs: - devise (3.3.0) - bcrypt (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) - responders - thread_safe (~> 0.1) - warden (~> 1.2.3) - GEM remote: https://rubygems.org/ specs: @@ -81,7 +68,7 @@ GEM active_attr (0.8.5) activemodel (>= 3.0.2, < 5.0) activesupport (>= 3.0.2, < 5.0) - active_decorator (0.4.0) + active_decorator (0.5.0) active_model_serializers (0.9.0) activemodel (>= 3.2) activejob (4.2.0) @@ -157,7 +144,7 @@ GEM coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.9.0) + coffee-script-source (1.9.1) colored (1.2) colorize (0.7.5) cookiejar (0.3.2) @@ -168,6 +155,14 @@ GEM crack (0.4.2) safe_yaml (~> 1.0.0) debug_inspector (0.0.2) + devise (3.4.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + responders + thread_safe (~> 0.1) + warden (~> 1.2.3) + devise-i18n (0.11.3) diff-lcs (1.2.5) docile (1.1.5) em-http-request (1.1.2) @@ -180,9 +175,9 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (1.5.0) activemodel - ember-data-source (1.0.0.beta.14.1) + ember-data-source (1.0.0.beta.15) ember-source (~> 1.8) - ember-rails (0.16.3) + ember-rails (0.16.4) active_model_serializers barber (>= 0.6.0) ember-data-source (>= 1.0.0.beta.5) @@ -203,7 +198,7 @@ GEM emblem-rails (0.2.2) barber-emblem (~> 0.1.1) ember-rails (>= 0.14.0) - emblem-source (0.3.18) + emblem-source (0.4.0) erubis (2.7.0) eventmachine (1.0.7) execjs (2.3.0) @@ -214,7 +209,7 @@ GEM railties (>= 3.0.0) faraday (0.9.1) multipart-post (>= 1.2, < 3) - faye (1.1.0) + faye (1.1.1) cookiejar (>= 0.3.0) em-http-request (>= 0.3.0) eventmachine (>= 0.12.0) @@ -254,7 +249,7 @@ GEM railties (>= 3.2) sprockets-rails json (1.8.2) - jwt (1.2.1) + jwt (1.3.0) kaminari (0.16.3) actionpack (>= 3.0.0) activesupport (>= 3.0.0) @@ -268,7 +263,7 @@ GEM mime-types (>= 1.16, < 3) method_source (0.8.2) mime-types (1.25.1) - mini_magick (4.0.4) + mini_magick (4.1.0) mini_portile (0.6.2) minitest (5.5.1) multi_json (1.10.1) @@ -289,7 +284,7 @@ GEM omniauth (1.2.2) hashie (>= 1.2, < 4) rack (~> 1.0) - omniauth-facebook (2.0.0) + omniauth-facebook (2.0.1) omniauth-oauth2 (~> 1.2) omniauth-instagram (1.0.1) omniauth (~> 1.0) @@ -353,26 +348,26 @@ GEM rspec-core (~> 3.2.0) rspec-expectations (~> 3.2.0) rspec-mocks (~> 3.2.0) - rspec-core (3.2.0) + rspec-core (3.2.1) rspec-support (~> 3.2.0) rspec-expectations (3.2.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.2.0) - rspec-its (1.1.0) + rspec-its (1.2.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.2.0) + rspec-mocks (3.2.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.2.0) - rspec-rails (3.2.0) - actionpack (>= 3.0, <= 4.2) - activesupport (>= 3.0, <= 4.2) - railties (>= 3.0, <= 4.2) + rspec-rails (3.2.1) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) rspec-core (~> 3.2.0) rspec-expectations (~> 3.2.0) rspec-mocks (~> 3.2.0) rspec-support (~> 3.2.0) - rspec-support (3.2.1) + rspec-support (3.2.2) ruby-progressbar (1.7.1) rubyzip (1.1.7) safe_yaml (1.0.4) @@ -388,11 +383,11 @@ GEM multi_json (~> 1.0) rubyzip (~> 1.0) websocket (~> 1.0) - simplecov (0.9.1) + simplecov (0.9.2) docile (~> 1.1.0) multi_json (~> 1.0) - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) + simplecov-html (~> 0.9.0) + simplecov-html (0.9.0) slim (3.0.2) temple (~> 0.7.3) tilt (>= 1.3.3, < 2.1) @@ -403,7 +398,7 @@ GEM railties (>= 3.1, < 5.0) slim (~> 3.0) slop (3.6.0) - spring (1.3.1) + spring (1.3.2) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprockets (2.12.3) @@ -444,9 +439,9 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) websocket (1.2.1) - websocket-driver (0.5.1) + websocket-driver (0.5.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.1) + websocket-extensions (0.1.2) xpath (2.0.0) nokogiri (~> 1.3) @@ -467,7 +462,8 @@ DEPENDENCIES cmtool! coffee-rails couch_potato! - devise! + devise + devise-i18n devise_simply_stored! ember-rails ember-source (= 1.8.1) diff --git a/app/assets/javascripts/theme1/application.js.coffee b/app/assets/javascripts/theme1/application.js.coffee index e78ef1b3..6c37c48d 100644 --- a/app/assets/javascripts/theme1/application.js.coffee +++ b/app/assets/javascripts/theme1/application.js.coffee @@ -1,7 +1,9 @@ #= require jquery #= require jquery_ujs +#= require vendor/modernizr +#= require foundation #= require_directory . #= require_self -$(document).on 'click', '.flash-box', -> $(@).slideUp() $ -> $('.menu-secondary-toggle').click -> $('.nav.secondary').toggleClass('active') + $(document).foundation() diff --git a/app/assets/stylesheets/theme1/_foundation_and_overrides.css.sass b/app/assets/stylesheets/theme1/_foundation_and_overrides.css.sass index df27059a..613e5272 100644 --- a/app/assets/stylesheets/theme1/_foundation_and_overrides.css.sass +++ b/app/assets/stylesheets/theme1/_foundation_and_overrides.css.sass @@ -1,7 +1,7 @@ // Taken from the bootstrap and overrides source, application not // verified body - .nav + .nav > li > a &:hover diff --git a/app/assets/stylesheets/theme1/_mixins.css.sass b/app/assets/stylesheets/theme1/_mixins.css.sass index f2d7e7c2..212c9046 100644 --- a/app/assets/stylesheets/theme1/_mixins.css.sass +++ b/app/assets/stylesheets/theme1/_mixins.css.sass @@ -27,6 +27,7 @@ padding-left: 8px padding-right: 8px line-height: 30px + box-shadow: 2px 6px 10px #333 &:hover color: white text-decoration: underline diff --git a/app/assets/stylesheets/theme1/elements/_devise.css.sass b/app/assets/stylesheets/theme1/elements/_devise.css.sass index 32324508..311914ec 100644 --- a/app/assets/stylesheets/theme1/elements/_devise.css.sass +++ b/app/assets/stylesheets/theme1/elements/_devise.css.sass @@ -1,3 +1,5 @@ -ul.devise-nav - +inline-list - +.devise-links + +sub-nav + margin-top: 22px + background-color: #f2f2f2 + padding: 10px 10px 10px 0 diff --git a/app/helpers/devise_helper.rb b/app/helpers/devise_helper.rb index 5cf0b9b0..e1839bf8 100644 --- a/app/helpers/devise_helper.rb +++ b/app/helpers/devise_helper.rb @@ -2,7 +2,7 @@ module DeviseHelper def devise_error_messages! if resource.errors.present? content_tag(:div, - content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", count: resource.errors.size)) + + content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", resource: resource.class.model_name.human, count: resource.errors.size)) + content_tag(:ul, resource.errors.full_messages.map{|m| content_tag(:li, m)}.join.html_safe), class: 'form-errors' ) diff --git a/app/models/employee.rb b/app/models/employee.rb index 46c359da..596e25e0 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -16,7 +16,7 @@ class Employee end #view :by_confirmation_token, key: :confirmation_token # devise confirmable - devise :database_authenticatable, :recoverable, :rememberable, :trackable #, :registerable #, :confirmable + devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable #, :registerable #, :confirmable property :unconfirmed_email property :name diff --git a/app/views/devise/_links.html.slim b/app/views/devise/_links.html.slim index 8b0b88cb..dbfb13d5 100644 --- a/app/views/devise/_links.html.slim +++ b/app/views/devise/_links.html.slim @@ -1,19 +1,23 @@ -ul.nav.nav-pills.devise-nav +dl.devise-links + - devise_mapping = Devise.mappings[resource_name] + dt= t 'devise.links.prefix' - if controller_name != 'sessions' - li= link_to t('devise.sessions.button'), new_session_path(resource_name), class: [:devise, :btn] + dd= link_to t('devise.sign_in.link'), new_session_path(resource_name), class: ['devise-link', 'new-session'] - if devise_mapping.registerable? && controller_name != 'registrations' - li= link_to t('devise.registrations.button'), new_registration_path(resource_name), class: [:devise, :btn] + dd= link_to t('devise.registrations.link'), new_registration_path(resource_name), class: ['devise-link', 'new-registration'] + - if resource_name == :employee and controller_name != 'new_suppliers' + dd= link_to t('devise.registrations.link'), new_suppliers_path, class: ['devise-link', 'new-registration'] - if devise_mapping.recoverable? && controller_name != 'passwords' - li= link_to t('devise.sessions.forgot_your_password'), new_password_path(resource_name), class: [:devise, :btn] + dd= link_to t('devise.passwords.link'), new_password_path(resource_name), class: ['devise-link', 'forgot-password'] - if devise_mapping.confirmable? && controller_name != 'confirmations' - li= link_to t('devise.confirmations.did_not_receive_instructions_link'), new_confirmation_path(resource_name), class: [:devise, :btn] + dd= link_to t('devise.confirmations.did_not_receive_instructions_link'), new_confirmation_path(resource_name), class: ['devise-link', 'did-not-receive-instructions'] - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - li= link_to t('devise.unlocks.did_not_receive_instructions_link'), new_unlock_path(resource_name), class: [:devise, :btn] + dd= link_to t('devise.unlocks.did_not_receive_instructions_link'), new_unlock_path(resource_name), class: ['devise-link', 'did-not-receive-instructions'] - if devise_mapping.omniauthable? - resource_class.omniauth_providers.each do |provider| - li= link_to t('devise.omniauth_callbacks.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), class: [:devise, :btn] + dd= link_to t('devise.omniauth_callbacks.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), class: ['devise-link', 'omniauth', provider] diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 00000000..45408119 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,16 @@ +
Welcome <%= @email %>!
+ +You can confirm your account email through the link below:
+ +<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 00000000..f667dc12 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +Hello <%= @resource.email %>!
+ +Someone has requested a link to change your password. You can do this through the link below.
+ +<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
+ +If you didn't request this, please ignore this email.
+Your password won't change until you access the link above and create a new one.
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 00000000..41e148bf --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +Hello <%= @resource.email %>!
+ +Your account has been locked due to an excessive number of unsuccessful sign in attempts.
+ +Click the link below to unlock your account:
+ +<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 00000000..3ea40f01 --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,39 @@ +Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 00000000..343b2656 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,29 @@ +Someone has requested a link to change your password, and you can do this through the link below.
-<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
+<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
If you didn't request this, please ignore this email.
Your password won't change until you access the link above and create a new one.
diff --git a/app/views/suppliers/passwords/edit.html.slim b/app/views/employees/passwords/edit.html.slim similarity index 75% rename from app/views/suppliers/passwords/edit.html.slim rename to app/views/employees/passwords/edit.html.slim index e6ec6029..8530022d 100644 --- a/app/views/suppliers/passwords/edit.html.slim +++ b/app/views/employees/passwords/edit.html.slim @@ -1,12 +1,12 @@ h2= t('devise.passwords.edit.title') -= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal', method: :put}) do |f| += form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {method: :put}) do |f| = devise_error_messages! = f.hidden_field :reset_password_token - .form-row + = f.row :password .form-label= f.label :password .form-field= f.password_field :password - = f.row :password_confirmation do + = f.row :password_confirmation .form-label= f.label :password_confirmation .form-field= f.password_field :password_confirmation .form-row= f.submit t('devise.passwords.edit.button'), class: 'button' -= render "links" += render "devise/links" diff --git a/app/views/suppliers/passwords/new.html.slim b/app/views/employees/passwords/new.html.slim similarity index 80% rename from app/views/suppliers/passwords/new.html.slim rename to app/views/employees/passwords/new.html.slim index 549eb8dd..f246458e 100644 --- a/app/views/suppliers/passwords/new.html.slim +++ b/app/views/employees/passwords/new.html.slim @@ -1,8 +1,8 @@ h2= t('devise.passwords.title') -= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal'}) do |f| += form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| = devise_error_messages! = f.row :email do .form-label= f.label :email, class: 'control-label' .form-field= f.email_field :email .form-row.form-actions= f.submit t('devise.passwords.button'), class: 'button' -= render "links" += render "devise/links" diff --git a/app/views/new_suppliers/new.html.slim b/app/views/new_suppliers/new.html.slim index 79181385..9d76b2a1 100644 --- a/app/views/new_suppliers/new.html.slim +++ b/app/views/new_suppliers/new.html.slim @@ -37,3 +37,4 @@ .form-actions = f.submit class: 'button' += render "devise/links", resource_name: :employee diff --git a/app/views/suppliers/sessions/new.html.slim b/app/views/suppliers/sessions/new.html.slim index cb0c88b5..21b2a767 100644 --- a/app/views/suppliers/sessions/new.html.slim +++ b/app/views/suppliers/sessions/new.html.slim @@ -1,17 +1,17 @@ -h2= t('devise.sessions.title') -= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-horizontal'}) do |f| +h2= t('devise.sign_in.title') += form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| = devise_error_messages! = f.row :email do .form-label= f.label :email .form-field= f.email_field :email = f.row :email do - .form-label= f.label :password, class: 'control-label' + .form-label= f.label :password .form-field= f.password_field :password .form-row = f.label :remember_me do = f.check_box :remember_me | - = t('devise.sessions.remember_me') + = t('devise.sign_in.remember_me') .form-row - = f.submit t('devise.sessions.button'), class: 'new-session-button' -= render "links" + = f.submit t('devise.sign_in.button'), class: 'devise-button new-session-button' += render "devise/links" diff --git a/app/views/theme1/_alerts.html.slim b/app/views/theme1/_alerts.html.slim index f00bd0e6..4f5c75d1 100644 --- a/app/views/theme1/_alerts.html.slim +++ b/app/views/theme1/_alerts.html.slim @@ -1,8 +1,8 @@ - if flash[:alert].present? - .alert-box.warning + .alert-box.warning data-alert=true = flash[:alert] a.close data-dismiss="alert" × - if flash[:notice].present? - .alert-box.info + .alert-box.info data-alert=true = flash[:notice] a.close data-dismiss="alert" × diff --git a/app/views/theme1/_social.html.slim b/app/views/theme1/_social.html.slim index 1cf6b9e3..0e285fdc 100644 --- a/app/views/theme1/_social.html.slim +++ b/app/views/theme1/_social.html.slim @@ -1,4 +1,3 @@ -a.theme-button Test .social a.wsite-social-facebook href="https://www.facebook.com/mozo.bar" target=:_blank span.wsite-social-inner @@ -8,3 +7,5 @@ a.theme-button Test span.wsite-social-inner /a.wsite-social-rss span.wsite-social-inner +.pull-right + = link_to t('devise.registrations.link'), new_suppliers_path, class: 'theme-button' diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index c272abf3..3b194112 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,76 +1,18 @@ -# Additional translations at https://github.com/plataformatec/devise/wiki/I18n - en: devise: - confirmations: - title: "Resend confirmation instructions" - submit_text: "Resend confirmation instructions" - confirmed: "Your account was successfully confirmed. Please sign in." - confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in." - send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." - failure: - already_authenticated: "You are already signed in." - inactive: "Your account is not activated yet." - invalid: "Invalid email or password." - invalid_token: "Invalid authentication token." - locked: "Your account is locked." - not_found_in_database: "Invalid email or password." - timeout: "Your session expired. Please sign in again to continue." - unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your account before continuing." - not_found_in_database: "You are not yet known in our system. Sign up to use mozo.bar!" - mailer: - confirmation_instructions: - supplier_subject: "Confirmation instructions2" - supplier: - salutation: "Welcome to mozo.bar %{email}!" - body: | -
- You requested a mozo.bar account or want to change data that need reconfirmation.
- If this is not wat you requested please ignore this email.
- To activate your account click the link below:
-
- Confirm my account or changes %{unconfirmed_email}
-
- Je hebt een account aangevraag bij mozo.bar of wil een wijziging doorvoeren waarvoor bevestiging nodig is.
- Als dit niet de bedoeling is kan je deze email negeren.
- Om je account te activeren of de aangevraagde wijziging door te voeren moet je op de bevestigingslink hieronder klikken:
-
- Bevestig mijn mozo.bar account of verandering %{unconfirmed_email}
-