diff --git a/Gemfile b/Gemfile index b28de653..9c007f6f 100644 --- a/Gemfile +++ b/Gemfile @@ -73,8 +73,8 @@ gem 'simply_stored', github: 'bterkuile/simply_stored', branch: :master 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', branch: :master gem 'devise-i18n' -gem 'omniauth-facebook' -gem 'omniauth-instagram' +#gem 'omniauth-facebook' +#gem 'omniauth-instagram' #gem 'simple_form' gem 'active_decorator' #, path: '/Users/bterkuile/companytools/development/rails/components/active_decorator' #gem 'cmtool', github: 'bterkuile/cmtool' diff --git a/Gemfile.lock b/Gemfile.lock index 10dd7df2..8c04deda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,9 +151,9 @@ GEM airbrussh (1.5.3) sshkit (>= 1.6.1, != 1.7.0) base64 (0.3.0) - bcrypt (3.1.20) + bcrypt (3.1.21) bcrypt_pbkdf (1.1.1) - bigdecimal (3.3.1) + bigdecimal (4.0.1) builder (3.3.0) cancancan (3.6.1) capistrano (3.19.2) @@ -197,8 +197,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.3.5) - connection_pool (2.5.4) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) cookiejar (0.3.4) couchrest (2.0.1) httpclient (~> 2.8) @@ -213,11 +213,11 @@ GEM cucumber-messages (29.0.1) cuke_modeler (3.26.0) cucumber-gherkin (< 37.0) - date (3.5.0) - devise (4.9.4) + date (3.5.1) + devise (5.0.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0) + railties (>= 7.0) responders warden (~> 1.2.3) devise-i18n (1.15.0) @@ -238,7 +238,7 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (2.2.4) activemodel - erb (6.0.0) + erb (6.0.1) erubi (1.13.1) eventmachine (1.2.7) exception_notification (5.0.1) @@ -250,12 +250,6 @@ GEM factory_bot_rails (6.5.1) factory_bot (~> 6.5) railties (>= 6.1.0) - faraday (2.14.0) - faraday-net_http (>= 2.0, < 3.5) - json - logger - faraday-net_http (3.4.2) - net-http (~> 0.5) faye (1.4.1) cookiejar (>= 0.3.0) em-http-request (>= 1.1.6) @@ -303,15 +297,15 @@ GEM google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) hashdiff (1.2.1) - hashie (5.0.0) http_parser.rb (0.8.0) httpclient (2.9.0) mutex_m - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) - io-console (0.8.1) - irb (1.15.3) + io-console (0.8.2) + irb (1.17.0) pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) iso_country_codes (0.7.8) @@ -324,9 +318,7 @@ GEM js-routes (2.3.5) railties (>= 5) sorbet-runtime - json (2.16.0) - jwt (3.1.2) - base64 + json (2.18.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -352,7 +344,7 @@ GEM letter_opener (1.10.0) launchy (>= 2.2, < 4) logger (1.7.0) - loofah (2.24.1) + loofah (2.25.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.9.0) @@ -374,16 +366,13 @@ GEM mini_magick (5.3.1) logger mini_mime (1.1.5) - minitest (5.26.2) + minitest (6.0.1) + prism (~> 1.5) momentjs-rails (2.29.4.1) railties (>= 3.1) multi_json (1.17.0) - multi_xml (0.7.2) - bigdecimal (~> 3.1) mutex_m (0.3.0) naught (1.1.0) - net-http (0.8.0) - uri (>= 0.11.1) net-imap (0.5.12) date net-protocol @@ -399,32 +388,12 @@ GEM net-protocol net-ssh (7.3.0) nio4r (2.7.5) - nokogiri (1.18.10-aarch64-linux-gnu) + nokogiri (1.19.0-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.10-x86_64-darwin) + nokogiri (1.19.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.10-x86_64-linux-gnu) + nokogiri (1.19.0-x86_64-linux-gnu) racc (~> 1.4) - oauth2 (2.0.18) - faraday (>= 0.17.3, < 4.0) - jwt (>= 1.0, < 4.0) - logger (~> 1.2) - multi_xml (~> 0.5) - rack (>= 1.2, < 4) - snaky_hash (~> 2.0, >= 2.0.3) - version_gem (~> 1.1, >= 1.1.9) - omniauth (1.9.2) - hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-facebook (10.0.0) - bigdecimal - omniauth-oauth2 (>= 1.2, < 3) - omniauth-instagram (1.3.0) - omniauth (~> 1) - omniauth-oauth2 (~> 1) - omniauth-oauth2 (1.7.3) - oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) orm_adapter (0.5.0) ostruct (0.6.3) paperclip (6.1.0) @@ -443,6 +412,7 @@ GEM pp (0.6.3) prettyprint prettyprint (0.2.0) + prism (1.9.0) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) @@ -451,23 +421,23 @@ GEM yard (~> 0.9.11) pry-rails (0.3.11) pry (>= 0.13.0) - psych (5.2.6) + psych (5.3.1) date stringio public_suffix (6.0.2) puma (7.1.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.21) + rack (3.2.4) rack-cors (2.0.2) rack (>= 2.0.0) - rack-session (1.0.2) - rack (< 3) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) - rackup (1.0.1) - rack (< 3) - webrick + rackup (2.3.1) + rack (>= 3) rails (8.1.1) actioncable (= 8.1.1) actionmailbox (= 8.1.1) @@ -506,7 +476,7 @@ GEM tsort (>= 0.2) zeitwerk (~> 2.6) rake (13.3.1) - rdoc (6.15.1) + rdoc (7.2.0) erb psych (>= 4.0.0) tsort @@ -573,9 +543,6 @@ GEM actionpack (>= 3.1) railties (>= 3.1) slim (>= 3.0, < 6.0, != 5.0.0) - snaky_hash (2.0.3) - hashie (>= 0.1.0, < 6) - version_gem (>= 1.1.8, < 3) sorbet-runtime (0.6.12780) sprockets (4.2.2) concurrent-ruby (~> 1.0) @@ -592,13 +559,13 @@ GEM net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) ostruct - stringio (3.1.8) + stringio (3.2.0) temple (0.10.4) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) test_squad (0.1.3) rails - thor (1.4.0) + thor (1.5.0) tilt (2.6.1) timecop (0.9.10) timeout (0.4.4) @@ -612,14 +579,12 @@ GEM execjs (>= 0.3.0, < 3) uri (1.1.1) useragent (0.16.11) - version_gem (1.1.9) warden (1.2.9) rack (>= 2.0.9) webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.9.1) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) @@ -627,7 +592,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.37) - zeitwerk (2.7.3) + zeitwerk (2.7.4) PLATFORMS aarch64-linux @@ -674,8 +639,6 @@ DEPENDENCIES mini_magick mutex_m naught - omniauth-facebook - omniauth-instagram pickadate-rails poltergeist pry-doc diff --git a/app/assets/stylesheets/theme1/elements/_forms.sass b/app/assets/stylesheets/theme1/elements/_forms.sass index cc31a12f..a2a64b0b 100644 --- a/app/assets/stylesheets/theme1/elements/_forms.sass +++ b/app/assets/stylesheets/theme1/elements/_forms.sass @@ -28,6 +28,12 @@ h3 color: $form-error-color font-size: 1.2em +// Temporary hack for some forms +.control-group + .controls + .error + // compensate the margin-bottom of the input above + margin-top: -16px body label &.number diff --git a/app/controllers/contact_forms_controller.rb b/app/controllers/contact_forms_controller.rb index 4b7d55cc..4803d41f 100644 --- a/app/controllers/contact_forms_controller.rb +++ b/app/controllers/contact_forms_controller.rb @@ -1,3 +1,4 @@ +# Contact page form class ContactFormsController < ApplicationController def create @contact_form = Cmtool::ContactForm.new(contact_form_params) diff --git a/app/controllers/suppliers/sessions_controller.rb b/app/controllers/employees/sessions_controller.rb similarity index 84% rename from app/controllers/suppliers/sessions_controller.rb rename to app/controllers/employees/sessions_controller.rb index 4146f7b7..2a9ae68f 100644 --- a/app/controllers/suppliers/sessions_controller.rb +++ b/app/controllers/employees/sessions_controller.rb @@ -1,4 +1,4 @@ -class Suppliers::SessionsController < Devise::SessionsController +class Employees::SessionsController < Devise::SessionsController respond_to :json def create @@ -10,6 +10,7 @@ class Suppliers::SessionsController < Devise::SessionsController render json: {employee_id: current_employee.id, auth_token: current_employee.authentication_token} end + # deprecated? def destroy session[:supplier_id] = nil super diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb new file mode 100644 index 00000000..7150a438 --- /dev/null +++ b/app/controllers/errors_controller.rb @@ -0,0 +1,5 @@ +class ErrorsController < ApplicationController + def not_found + head :not_found # Renders an empty body with 404 status [5] + end +end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index bb71c0ec..bb6544de 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,13 +1,13 @@ -class RegistrationsController < Devise::RegistrationsController - protected - - #def after_sign_up_path(resource) - #end - - private - - # override devise internal to allow name as sign_up param - def sign_up_params - params.require(resource_name).permit resource_class.authentication_keys + [:name, :password, :password_confirmation] - end -end +# class RegistrationsController < Devise::RegistrationsController +# protected +# +# #def after_sign_up_path(resource) +# #end +# +# private +# +# # override devise internal to allow name as sign_up param +# def sign_up_params +# params.require(resource_name).permit resource_class.authentication_keys + [:name, :password, :password_confirmation] +# end +# end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb new file mode 100644 index 00000000..4313b537 --- /dev/null +++ b/app/controllers/users/registrations_controller.rb @@ -0,0 +1,9 @@ +class Users::RegistrationsController < Devise::RegistrationsController + def create + devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) + super + # if resource.persisted? + # self.response_body = nil + # end + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 00000000..106020f6 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,6 @@ +class UsersController < ApplicationController + def show + authenticate_user! + @user = current_user + end +end diff --git a/app/controllers/waiter_controller.rb b/app/controllers/waiter_controller.rb index d3b454d3..e14c8330 100644 --- a/app/controllers/waiter_controller.rb +++ b/app/controllers/waiter_controller.rb @@ -1,20 +1,20 @@ -class WaiterController < ApplicationController - layout 'waiter' - def index - - end - - def product_categories - respond_to do |format| - format.html { redirect_to '/waiter'} - format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer } - end - end - - def order_products - @table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id]) - @list = List.from_table_by_employee(@table, current_employee) - @list.place_order products: params[:order], employee: current_employee - render nothing: true - end -end +# class WaiterController < ApplicationController +# layout 'waiter' +# def index +# +# end +# +# def product_categories +# respond_to do |format| +# format.html { redirect_to '/waiter'} +# format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer } +# end +# end +# +# def order_products +# @table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id]) +# @list = List.from_table_by_employee(@table, current_employee) +# @list.place_order products: params[:order], employee: current_employee +# render nothing: true +# end +# end diff --git a/app/models/user.rb b/app/models/user.rb index 99217024..782439c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,7 +14,7 @@ class User property :oauth_expires_at property :auth_data - devise_plugins = [:database_authenticatable, :recoverable, :rememberable, :trackable, :omniauthable, {omniauth_providers: [:facebook, :instagram]}] #, :token_authenticatable , :registerable + devise_plugins = [:database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable] #, :omniauthable, {omniauth_providers: [:facebook, :instagram]}] #, :token_authenticatable , :registerable devise_plugins -= [:trackable] if Rails.env.test? # creates conflicts devise *devise_plugins diff --git a/app/views/devise/_links.html.slim b/app/views/devise-disabled/_links.html.slim similarity index 100% rename from app/views/devise/_links.html.slim rename to app/views/devise-disabled/_links.html.slim diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise-disabled/confirmations/new.html.erb similarity index 100% rename from app/views/devise/confirmations/new.html.erb rename to app/views/devise-disabled/confirmations/new.html.erb diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise-disabled/mailer/confirmation_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/confirmation_instructions.html.erb rename to app/views/devise-disabled/mailer/confirmation_instructions.html.erb diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise-disabled/mailer/reset_password_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/reset_password_instructions.html.erb rename to app/views/devise-disabled/mailer/reset_password_instructions.html.erb diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise-disabled/mailer/unlock_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/unlock_instructions.html.erb rename to app/views/devise-disabled/mailer/unlock_instructions.html.erb diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise-disabled/registrations/edit.html.erb similarity index 100% rename from app/views/devise/registrations/edit.html.erb rename to app/views/devise-disabled/registrations/edit.html.erb diff --git a/app/views/devise/registrations/new.html.slim b/app/views/devise-disabled/registrations/new.html.slim similarity index 85% rename from app/views/devise/registrations/new.html.slim rename to app/views/devise-disabled/registrations/new.html.slim index 7e4d99ef..04808147 100644 --- a/app/views/devise/registrations/new.html.slim +++ b/app/views/devise-disabled/registrations/new.html.slim @@ -2,6 +2,7 @@ h2= t('devise.registrations.title') = form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f| = devise_error_messages! .control-group + - binding.pry = f.label :name, class: 'control-label' .controls= f.text_field :name .control-group @@ -15,5 +16,5 @@ h2= t('devise.registrations.title') .controls= f.password_field :password_confirmation .control-group .controls - = f.submit t('devise.registrations.button'), class: 'btn btn-primary' -= render "devise_links" + = f.submit t('devise.registrations.button'), class: 'button2' += render "devise/links" diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise-disabled/sessions/new.html.erb similarity index 100% rename from app/views/devise/sessions/new.html.erb rename to app/views/devise-disabled/sessions/new.html.erb diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise-disabled/shared/_links.html.erb similarity index 100% rename from app/views/devise/shared/_links.html.erb rename to app/views/devise-disabled/shared/_links.html.erb diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise-disabled/unlocks/new.html.erb similarity index 100% rename from app/views/devise/unlocks/new.html.erb rename to app/views/devise-disabled/unlocks/new.html.erb diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb deleted file mode 100644 index 343b2656..00000000 --- a/app/views/devise/registrations/new.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Sign up

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %> - <% if @validatable %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/app/views/users/confirmations/new.html.erb b/app/views/users/confirmations/new.html.erb deleted file mode 100644 index 18d81b14..00000000 --- a/app/views/users/confirmations/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

Resend confirmation instructions

- -<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> - <%= devise_error_messages! %> - -
<%= f.label :email %>
- <%= f.email_field :email %>
- -
<%= f.submit "Resend confirmation instructions" %>
-<% end %> - -<%= render "links" %> \ No newline at end of file diff --git a/app/views/users/confirmations/new.html.slim b/app/views/users/confirmations/new.html.slim new file mode 100644 index 00000000..21bb408b --- /dev/null +++ b/app/views/users/confirmations/new.html.slim @@ -0,0 +1,11 @@ +h2= t('devise.user.confirmations.title') += form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: {class: 'form-horizontal'}) do |f| + = devise_error_messages! + .control-group + = f.label :email, class: 'control-label' + .controls + = f.email_field :email + .control-group + .controls + = f.submit t('devise.user.confirmations.button'), class: 'button' += render 'users/devise/links' diff --git a/app/views/users/devise/_links.html.slim b/app/views/users/devise/_links.html.slim new file mode 100644 index 00000000..2401005b --- /dev/null +++ b/app/views/users/devise/_links.html.slim @@ -0,0 +1,23 @@ +dl.devise-links + - devise_mapping = Devise.mappings[resource_name] + dt= t 'devise.links.prefix' + - if controller_name != 'sessions' + dd= link_to t('devise.user.sign_in.link'), new_session_path(resource_name), class: ['devise-link', 'new-session'] + + - if devise_mapping.registerable? && controller_name != 'registrations' + dd= link_to t('devise.user.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.user.registrations.link'), new_suppliers_path, class: ['devise-link', 'new-registration'] + + - if devise_mapping.recoverable? && controller_name != 'passwords' + dd= link_to t('devise.user.passwords.link'), new_password_path(resource_name), class: ['devise-link', 'forgot-password'] + + - if devise_mapping.confirmable? && controller_name != 'confirmations' + dd= link_to t('devise.user.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' + dd= link_to t('devise.user.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| + dd= link_to t('devise.user.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/users/mailer/confirmation_instructions.html.slim b/app/views/users/mailer/confirmation_instructions.html.slim index f48b3385..bc9367be 100644 --- a/app/views/users/mailer/confirmation_instructions.html.slim +++ b/app/views/users/mailer/confirmation_instructions.html.slim @@ -1,6 +1,6 @@ -p= t('devise.mailer.confirmation_instructions.salutation', email: @resource.email) +p== t('mailer.user.confirmation_instructions.salutation', email: @resource.email) -p=raw t \ - 'devise.mailer.confirmation_instructions.body', +p== t \ + 'mailer.user.confirmation_instructions.body', unconfirmed_email: @resource.unconfirmed_email, - confirm_url: confirmation_url(@resource, :confirmation_token => @token) + confirm_url: confirmation_url(@resource, confirmation_token: @token) diff --git a/app/views/users/passwords/edit.html.slim b/app/views/users/passwords/edit.html.slim index 6a71746c..174eb4a4 100644 --- a/app/views/users/passwords/edit.html.slim +++ b/app/views/users/passwords/edit.html.slim @@ -1,4 +1,4 @@ -h2= t('devise.passwords.edit.title') +h2= t('devise.user.passwords.edit.title') = form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal', method: :put}) do |f| = devise_error_messages! = f.hidden_field :reset_password_token @@ -10,5 +10,5 @@ h2= t('devise.passwords.edit.title') .controls= f.password_field :password_confirmation .control-group .controls - = f.submit t('devise.passwords.edit.button'), class: 'btn btn-primary' -= render "links" + = f.submit t('devise.user.passwords.edit.button'), class: 'button' += render 'users/devise/links' diff --git a/app/views/users/passwords/new.html.slim b/app/views/users/passwords/new.html.slim index c0304fc9..4d800132 100644 --- a/app/views/users/passwords/new.html.slim +++ b/app/views/users/passwords/new.html.slim @@ -1,4 +1,4 @@ -h2= t('devise.passwords.title') +h2= t('devise.user.passwords.title') = form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal'}) do |f| = devise_error_messages! .control-group @@ -6,5 +6,5 @@ h2= t('devise.passwords.title') .controls= f.email_field :email .control-group .controls - = f.submit t('devise.passwords.button'), class: 'btn btn-primary' -= render "links" + = f.submit t('devise.user.passwords.button'), class: 'button' += render 'users/devise/links' diff --git a/app/views/users/registrations/new.html.slim b/app/views/users/registrations/new.html.slim index 4c70a247..1d741fb5 100644 --- a/app/views/users/registrations/new.html.slim +++ b/app/views/users/registrations/new.html.slim @@ -1,19 +1,22 @@ -h2= t('devise.registrations.title') -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f| +h2= t('devise.user.registrations.title') += form_for(resource, as: resource_name, url: registration_path(resource_name), html: {class: 'form-horizontal'}) do |f| = devise_error_messages! .control-group = f.label :name, class: 'control-label' .controls= f.text_field :name .control-group - = f.label :email, class: 'control-label' - .controls= f.email_field :email + = f.label :email, class: 'control-label' + .controls + = f.email_field :email + - if f.object.errors[:email].present? + small.error= f.object.errors[:email].to_sentence .control-group - = f.label :password, class: 'control-label' - .controls= f.password_field :password + = f.label :password, class: 'control-label' + .controls= f.password_field :password .control-group - = f.label :password_confirmation, class: 'control-label' - .controls= f.password_field :password_confirmation + = f.label :password_confirmation, class: 'control-label' + .controls= f.password_field :password_confirmation .control-group .controls - = f.submit t('devise.registrations.button'), class: 'btn btn-primary' -= render "links" + = f.submit t('devise.user.registrations.button'), class: 'button' += render 'users/devise/links' diff --git a/app/views/users/sessions/new.html.slim b/app/views/users/sessions/new.html.slim index e68cfa01..4aa8496a 100644 --- a/app/views/users/sessions/new.html.slim +++ b/app/views/users/sessions/new.html.slim @@ -1,19 +1,25 @@ -h2= t('devise.sessions.title') +h2= t('devise.user.sign_in.title') = form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-horizontal'}) do |f| = devise_error_messages! .control-group - = f.label :email, class: 'control-label' - .controls= f.email_field :email + = f.label :email, class: 'control-label' + .controls + = f.email_field :email + - if f.object.errors[:email].present? + small.error= f.object.errors[:email].to_sentence .control-group - = f.label :password, class: 'control-label' - .controls= f.password_field :password + = f.label :password, class: 'control-label' + .controls + = f.password_field :password + - if f.object.errors[:password].present? + small.error= f.object.errors[:password].to_sentence .control-group .controls = f.label :remember_me do = f.check_box :remember_me |  - = t('devise.sign_in.remember_me') + = t('devise.user.sign_in.remember_me') .control-group .controls - = f.submit t('devise.sign_in.button'), class: 'button' -= render "links" + = f.submit t('devise.user.sign_in.button'), class: 'button' += render 'users/devise/links' diff --git a/config/application.rb b/config/application.rb index 3b47330f..6e5473dc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -40,7 +40,7 @@ if Rails.env.development? alias_method :old_execute, :execute def execute(method, path, options, payload = nil, &block) Rails.logger.debug "Couch: #{method} #{Rack::Utils.unescape path} #{options}" - puts "Couch: #{method} #{Rack::Utils.unescape path} #{options}" + #puts "Couch: #{method} #{Rack::Utils.unescape path} #{options}" old_execute(method, path, options, payload, &block) end end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index d368e114..c26bdf09 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -256,10 +256,10 @@ Devise.setup do |config| provider_ignores_state: true config.omniauth :instagram, "cd7bdfbee825499b94fb3783d1bc143b", "6b4f9ecf251c462993a696eebc0189be" else - config.omniauth :facebook, "168928633304849", "22bc53e1a390c1e62d004195c55fe336", - scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location', - provider_ignores_state: true - config.omniauth :instagram, "81c78b969a7046d6b6b5b5fe3f30929c", "3697c16762ad4f1ca088e829efbaddde" + # config.omniauth :facebook, "168928633304849", "22bc53e1a390c1e62d004195c55fe336", + # scope: 'email,user_birthday,user_gender,user_hometown,user_link,user_location', + # provider_ignores_state: true + # config.omniauth :instagram, "81c78b969a7046d6b6b5b5fe3f30929c", "3697c16762ad4f1ca088e829efbaddde" end # ==> Warden configuration diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 6c8ade45..3da3f2e5 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,2 +1,2 @@ -OmniAuth.config.full_host = Rails.env.production? ? 'https://www.mozo.bar' : 'https://localhost:3002' +#OmniAuth.config.full_host = Rails.env.production? ? 'https://www.mozo.bar' : 'https://localhost:3002' diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 9647921a..87136241 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,19 +1,24 @@ en: devise: - sign_in: - title: Sign in - remember_me: Remember me - link: Sign in - button: Sign in - passwords: - title: Recover password - link: Recover password - button: Send reset - edit: - title: Change your password - button: Change password - registrations: - title: Sign up for mozo as a restaurant - link: Sign up + user: + sign_in: + title: Sign in + remember_me: Remember me + link: Sign in + button: Sign in + passwords: + title: Recover password + link: Recover password + button: Send reset + edit: + title: Change your password + button: Change password + registrations: + title: Sign up for mozo as a user + link: Sign up + button: Sign up + confirmations: + title: Resend confirmation instructions + button: Resend confirmation instructions links: prefix: 'OR:' diff --git a/config/locales/devise.nl.yml b/config/locales/devise.nl.yml index 0b38ce5a..98f409f6 100644 --- a/config/locales/devise.nl.yml +++ b/config/locales/devise.nl.yml @@ -1,19 +1,24 @@ nl: devise: - sign_in: - title: Inloggen - remember_me: Mij onthouden - link: Inloggen - button: Inloggen - passwords: - title: Wachtwoord vergeten - link: Wachtwoord vergeten - button: Stuur reset - edit: - title: Change your password - button: Change password - registrations: - title: Aanmelden als restaurant - link: Aanmelden + user: + sign_in: + title: Inloggen + remember_me: Mij onthouden + link: Inloggen + button: Inloggen + passwords: + title: Wachtwoord vergeten + link: Wachtwoord vergeten + button: Stuur reset + edit: + title: Change your password + button: Change password + registrations: + title: Aanmelden als gebruiker + link: Aanmelden + button: Aanmelden + confirmations: + title: Resend confirmation instructions + button: Resend confirmation instructions links: prefix: 'OF:' diff --git a/config/locales/mailer.en.yml b/config/locales/mailer.en.yml new file mode 100644 index 00000000..e894020d --- /dev/null +++ b/config/locales/mailer.en.yml @@ -0,0 +1,12 @@ +en: + mailer: + supplier: + creation: + subject: 'Weklom bij mozo.bar' + title: 'De aanmelding van %{name} bij mozo.bar is gelukt!' + user: + confirmation_instructions: + salutation: Welcome to mozo.bar. You registered a new account as %{email} + body: | + Your registration at the moment is unconfirmed. To confirm your email, click on the following link: + Confirm %{unconfirmed_email} diff --git a/config/locales/mailer.nl.yml b/config/locales/mailer.nl.yml index cf5596ab..f72efc9f 100644 --- a/config/locales/mailer.nl.yml +++ b/config/locales/mailer.nl.yml @@ -4,3 +4,9 @@ nl: creation: subject: 'Weklom bij mozo.bar' title: 'De aanmelding van %{name} bij mozo.bar is gelukt!' + user: + confirmation_instructions: + salutation: Welcome to mozo.bar. You registered a new account as %{email} + body: | + Your registration at the moment is unconfirmed. To confirm your email, click on the following link: + Confirm %{unconfirmed_email}> diff --git a/config/routes.rb b/config/routes.rb index 77ce44d0..2e715fa9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,13 +1,19 @@ ALLOWED_LOCALES = /nl|de|fr|en|es/ Mozo::Application.routes.draw do - devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" } + match '/.well-known/*rest', to: 'errors#not_found', via: :all + match '/system/*rest', to: 'errors#not_found', via: :all + devise_for :users, controllers: { + registrations: 'users/registrations' + } #, controllers: { omniauth_callbacks: "users/omniauth_callbacks" } + resources :users, only: [:show] #devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' } devise_for :employees, controllers: { #confirmations: 'confirmations', #registrations: 'registrations', - sessions: 'suppliers/sessions' + sessions: 'employees/sessions' } devise_for :administrators + namespace :admin do resources :users do collection do