diff --git a/Gemfile b/Gemfile
index 89bc3c9..1fcb52c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -111,16 +111,14 @@ gem "font-awesome-rails"
# gem "recaptcha", require: "recaptcha/rails"
-gem "sprockets", '3.6.3'
+gem "sprockets"
#gem "activemodel-serializers-xml"
# Authentication against Google, Facebook and others
gem 'omniauth'
-gem 'omniauth-amazon'
-gem 'omniauth-google-oauth2'
-gem 'omniauth-github'
-gem 'omniauth-twitter'
-gem 'omniauth-facebook'
-# gem 'omniauth-launchpad' # is broken
-gem 'omniauth-launchpad', :git => 'https://github.com/joaopapereira/omniauth-launchpad'
+# gem 'omniauth-amazon'
+# gem 'omniauth-google-oauth2'
+# gem 'omniauth-github'
+# gem 'omniauth-twitter'
+gem 'omniauth-openid'
diff --git a/Gemfile.lock b/Gemfile.lock
index 69a9ed7..79ff53a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,15 +4,6 @@ GIT
specs:
bzip2-ruby (0.2.7)
-GIT
- remote: https://github.com/joaopapereira/omniauth-launchpad
- revision: 948a3c405594651b775457db87f62b7d61e1824d
- specs:
- omniauth-launchpad (0.0.1)
- multi_json (~> 1.3)
- omniauth (>= 1.1.1)
- omniauth-oauth
-
GEM
remote: https://rubygems.org/
specs:
@@ -95,8 +86,6 @@ GEM
execjs (2.7.0)
fancybox2-rails (0.2.7)
railties (>= 3.1.0)
- faraday (0.11.0)
- multipart-post (>= 1.2, < 3)
ffi (1.9.18)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
@@ -135,7 +124,6 @@ GEM
js_cookie_rails (2.1.4)
railties (>= 3.1)
json (1.8.6)
- jwt (1.5.6)
libv8 (3.16.14.19)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
@@ -161,8 +149,6 @@ GEM
minitest (>= 5.0)
ruby-progressbar
multi_json (1.12.1)
- multi_xml (0.6.0)
- multipart-post (2.0.0)
nenv (0.3.0)
nio4r (2.0.0)
nokogiri (1.7.1)
@@ -170,38 +156,12 @@ GEM
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
- oauth (0.5.1)
- oauth2 (1.3.1)
- faraday (>= 0.8, < 0.12)
- jwt (~> 1.0)
- multi_json (~> 1.3)
- multi_xml (~> 0.5)
- rack (>= 1.2, < 3)
omniauth (1.6.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
- omniauth-amazon (1.0.1)
+ omniauth-openid (1.0.1)
omniauth (~> 1.0)
- omniauth-oauth2 (~> 1.1)
- omniauth-facebook (4.0.0)
- omniauth-oauth2 (~> 1.2)
- omniauth-github (1.2.3)
- omniauth (~> 1.5)
- omniauth-oauth2 (>= 1.4.0, < 2.0)
- omniauth-google-oauth2 (0.4.1)
- jwt (~> 1.5.2)
- multi_json (~> 1.3)
- omniauth (>= 1.1.1)
- omniauth-oauth2 (>= 1.3.1)
- omniauth-oauth (1.1.0)
- oauth
- omniauth (~> 1.0)
- omniauth-oauth2 (1.4.0)
- oauth2 (~> 1.0)
- omniauth (~> 1.2)
- omniauth-twitter (1.4.0)
- omniauth-oauth (~> 1.1)
- rack
+ rack-openid (~> 1.3.1)
orm_adapter (0.5.0)
paperclip (5.1.0)
activemodel (>= 4.2.0)
@@ -220,6 +180,9 @@ GEM
slop (~> 3.4)
puma (3.8.2)
rack (2.0.1)
+ rack-openid (1.3.1)
+ rack (>= 1.1.0)
+ ruby-openid (>= 2.1.8)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.2)
@@ -259,6 +222,7 @@ GEM
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
ruby-graphviz (1.2.3)
+ ruby-openid (2.7.0)
ruby-progressbar (1.8.1)
sass (3.4.23)
sass-rails (5.0.6)
@@ -284,7 +248,7 @@ GEM
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
- sprockets (3.6.3)
+ sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
@@ -307,7 +271,7 @@ GEM
turbolinks-source (5.0.0)
tzinfo (1.2.3)
thread_safe (~> 0.1)
- uglifier (3.1.13)
+ uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
warden (1.2.7)
rack (>= 1.0)
@@ -343,12 +307,7 @@ DEPENDENCIES
minitest-rails
minitest-reporters
omniauth
- omniauth-amazon
- omniauth-facebook
- omniauth-github
- omniauth-google-oauth2
- omniauth-launchpad!
- omniauth-twitter
+ omniauth-openid
paperclip
pg
pg_search
@@ -360,7 +319,7 @@ DEPENDENCIES
slim-rails
spring
spring-watcher-listen (~> 2.0.0)
- sprockets (= 3.6.3)
+ sprockets
therubyracer
turbolinks (~> 5)
uglifier (>= 1.3.0)
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index 5c664f1..74bfae8 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -1,57 +1,30 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
- # def passthru
- # raise
- # send(params[:provider]) if providers.include?(params[:provider])
- # end
+ # Workaround for https://github.com/plataformatec/devise/issues/2432
+ skip_before_filter :verify_authenticity_token
def launchpad
+ login_via 'Launchpad'
+ end
+
+ def stackexchange
+ login_via 'StackExchange'
+ end
+
+ def login_via(provider_name)
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.persisted?
- flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Launchpad"
+ flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => provider_name
sign_in_and_redirect @user, :event => :authentication
else
- # session["devise.google_data"] = request.env["omniauth.auth"].except(:extra) #Removing extra as it can overflow some session stores
- redirect_to new_user_session_url, alert: @user.errors.full_messages.join("\n")
- end
-
- end
-
- def google_oauth2
- # You need to implement the method below in your model (e.g. app/models/user.rb)
- @user = User.from_omniauth(request.env["omniauth.auth"])
-
- if @user.persisted?
- flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google"
- sign_in_and_redirect @user, :event => :authentication
- else
- # session["devise.google_data"] = request.env["omniauth.auth"].except(:extra) #Removing extra as it can overflow some session stores
redirect_to new_user_session_url, alert: @user.errors.full_messages.join("\n")
end
end
- def amazon
- # You need to implement the method below in your model (e.g. app/models/user.rb)
- @user = User.from_omniauth(request.env["omniauth.auth"])
-
- if @user.persisted?
- flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Amazon"
- sign_in_and_redirect @user, :event => :authentication
- else
- # session["devise.google_data"] = request.env["omniauth.auth"].except(:extra) #Removing extra as it can overflow some session stores
- redirect_to new_user_session_url, alert: @user.errors.full_messages.join("\n")
- end
+ def failure
+ redirect_to root_path
end
- # def failure
- # redirect_to root_path
- # end
-
- # private
- #
- # def providers
- # ["twitter", "google_oauth2", "launchpad", "amazon"]
- # end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 9547e4e..0ccd856 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,23 +1,25 @@
class User < ApplicationRecord
+
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
# :registerable,
- :recoverable,
+ # :recoverable,
# :rememberable,
:trackable,
# :validatable,
:timeoutable,
# :lockable,
- :omniauthable, :omniauth_providers => [:google_oauth2, :launchpad, :amazon]
- # :omniauthable, :omniauth_providers => [:launchpad, :google]
+ :omniauthable, :omniauth_providers => [:launchpad,:stackexchange]
def self.from_omniauth(auth)
- where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
+ where(provider: auth.provider, email: auth.info.email).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
user.email = auth.info.email
+ user.name = auth.info.name
+ # Set a random password
user.password = Devise.friendly_token[0,20]
end
end
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb
new file mode 100644
index 0000000..dc55f64
--- /dev/null
+++ b/app/views/devise/mailer/confirmation_instructions.html.erb
@@ -0,0 +1,5 @@
+
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/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb
new file mode 100644
index 0000000..b41daf4
--- /dev/null
+++ b/app/views/devise/mailer/password_change.html.erb
@@ -0,0 +1,3 @@
+Hello <%= @resource.email %>!
+
+We're contacting you to notify you that your password has been changed.
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 0000000..f667dc1
--- /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 0000000..41e148b
--- /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/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
new file mode 100644
index 0000000..6a796b0
--- /dev/null
+++ b/app/views/devise/passwords/edit.html.erb
@@ -0,0 +1,25 @@
+Change your password
+
+<%= 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 %>
+
+
+ <%= f.label :password, "New password" %>
+ <% if @minimum_password_length %>
+ (<%= @minimum_password_length %> characters minimum)
+ <% end %>
+ <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
+
+
+
+ <%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
+
+
+
+ <%= f.submit "Change my password" %>
+
+<% end %>
+
+<%= render "devise/shared/links" %>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
new file mode 100644
index 0000000..3d6d11a
--- /dev/null
+++ b/app/views/devise/passwords/new.html.erb
@@ -0,0 +1,16 @@
+Forgot your password?
+
+<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %>
+
+
+
+ <%= f.submit "Send me reset password instructions" %>
+
+<% end %>
+
+<%= render "devise/shared/links" %>
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
new file mode 100644
index 0000000..1e66f3d
--- /dev/null
+++ b/app/views/devise/registrations/edit.html.erb
@@ -0,0 +1,43 @@
+Edit <%= resource_name.to_s.humanize %>
+
+<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
+ <%= devise_error_messages! %>
+
+
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %>
+
+
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
+ Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %>
+
+
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "off" %>
+ <% if @minimum_password_length %>
+
+ <%= @minimum_password_length %> characters minimum
+ <% end %>
+
+
+
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
+
+
+
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "off" %>
+
+
+
+ <%= f.submit "Update" %>
+
+<% end %>
+
+Cancel my account
+
+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 0000000..5a238ce
--- /dev/null
+++ b/app/views/devise/registrations/new.html.erb
@@ -0,0 +1,29 @@
+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 @minimum_password_length %>
+ (<%= @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/devise/sessions/new.slim b/app/views/devise/sessions/new.slim
index 20ed454..3b79140 100644
--- a/app/views/devise/sessions/new.slim
+++ b/app/views/devise/sessions/new.slim
@@ -35,8 +35,21 @@
/ = link_to 'log in using your secure certificate', users_debian_sso_path
/ = link_to "Sign in with Launchpad", user_launchpad_omniauth_authorize_path
-= link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path
+/ = link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path
= link_to "Sign in with Launchpad", user_launchpad_omniauth_authorize_path
+= link_to "Sign in with StackExchange", user_stackexchange_omniauth_authorize_path
-= link_to "Sign in with Amazon", user_amazon_omniauth_authorize_path
+/ div
+/ = link_to image_tag('/images/sso/google.png'), user_google_oauth2_omniauth_authorize_path
+
+/ div
+/ = link_to "google new", user_google_omniauth_authorize_path
+
+/
+/ div
+/ = link_to image_tag('/images/sso/amazon.png'), user_amazon_omniauth_authorize_path
+/
+/ div
+/ stackexchange
+/
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb
new file mode 100644
index 0000000..e6a3e41
--- /dev/null
+++ b/app/views/devise/shared/_links.html.erb
@@ -0,0 +1,25 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Log in", new_session_path(resource_name) %>
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%>
+
+<%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%>
+<% end -%>
diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb
new file mode 100644
index 0000000..16586bc
--- /dev/null
+++ b/app/views/devise/unlocks/new.html.erb
@@ -0,0 +1,16 @@
+Resend unlock instructions
+
+<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %>
+
+
+
+ <%= f.submit "Resend unlock instructions" %>
+
+<% end %>
+
+<%= render "devise/shared/links" %>
diff --git a/app/views/packages/my_uploads.slim b/app/views/packages/my_uploads.slim
deleted file mode 100644
index a7700cd..0000000
--- a/app/views/packages/my_uploads.slim
+++ /dev/null
@@ -1,23 +0,0 @@
-// Show users' own uploaded screenshots in this session
-
-/ = link_to 'Back', :back, class: 'button small'
-
-.row.packagepage
- h1 Screenshots you uploaded
-
- - @packages.each do |package|
- h2 Package #{package.name}
- .subtitle
- = package.description
-
- .small-9.large-10.columns
- - if @current_users_screenshots.length>0
- .row.small-up-1.medium-up-3.large-up-4.grid-thumbnails
- - @current_users_screenshots.each do |screenshot|
- .column
-
- a.black.fancybox href=screenshot.image.url(:large, timestamp: false)
- div.grid-thumbnail
- = image_tag(screenshot.image.url(:thumb, timestamp: false), alt: screenshot.caption, class: 'thumbnail')
- div
- = screenshot.description
diff --git a/bin/rails b/bin/rails
index f2b0313..0739660 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/rake b/bin/rake
index d87d5f5..1724048 100755
--- a/bin/rake
+++ b/bin/rake
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
require_relative '../config/boot'
require 'rake'
Rake.application.run
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..e620b4d
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/update b/bin/update
new file mode 100755
index 0000000..a8e4462
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 65a74d5..906e235 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -50,7 +50,7 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Suppress logger output for asset requests.
config.assets.quiet = true
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 6ae68a1..69624d8 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -16,7 +16,8 @@ Rails.application.configure do
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ # config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ config.public_file_server.enabled = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -87,12 +88,6 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
- # Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_files = false
- # Disable serving static files from the `/public` folder by default since
- # Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
-
config.package_sources = [
{
description: 'Debian Unstable (Sid)', type: 'apt', url: 'http://ftp.de.debian.org/debian/dists/sid',
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 4f154be..a7ee23c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -12,15 +12,12 @@ Debshots::Application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # ActiveRecord errors propagate normally (forward deprecation to Rails 5)
- config.active_record.raise_in_transactional_callbacks = true
-
# Test :sorted or :random. ":random" may be safer but harder to debug.
config.active_support.test_order = :sorted
# Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_files = true
- config.static_cache_control = "public, max-age=3600"
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
@@ -57,5 +54,5 @@ Debshots::Application.configure do
config.image_sizes = {
large: '800x600',
small: '160x120',
- }
+ }
end
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
new file mode 100644
index 0000000..51639b6
--- /dev/null
+++ b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,6 @@
+# Be sure to restart your server when you modify this file.
+
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..1389e86
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index f5a4423..ced94cb 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -243,7 +243,7 @@ Devise.setup do |config|
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
- config.sign_out_via = :delete
+ # config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
@@ -274,12 +274,15 @@ Devise.setup do |config|
# config.omniauth_path_prefix = '/my_engine/users/auth'
# config.omniauth :launchpad, 'debshots'
- config.omniauth :google_oauth2, '398593918966-0fpmit0pb6ptio1ndsie5dfcnqhei63l.apps.googleusercontent.com', 'uRQq_dLs1kx7l5sYIyEyPVRc', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ # config.omniauth :google_oauth2, '398593918966-0fpmit0pb6ptio1ndsie5dfcnqhei63l.apps.googleusercontent.com', 'uRQq_dLs1kx7l5sYIyEyPVRc', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ #
+ # # config.omniauth :launchpad, 'Debian Screenshots', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ #
+ # config.omniauth :amazon, 'amzn1.application-oa2-client.78d832919fc24456b0636762cf18efd9', '8c495d0940ca4100313c03e93b8b4240eef256d2fdbe672718506f29f5a20f61', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
- config.omniauth :launchpad, 'Debian Screenshots', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ config.omniauth :open_id, name: :stackexchange, identifier: 'https://openid.stackexchange.com', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ config.omniauth :open_id, name: :launchpad, identifier: 'https://login.ubuntu.com', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
- config.omniauth :amazon, 'amzn1.application-oa2-client.78d832919fc24456b0636762cf18efd9', '8c495d0940ca4100313c03e93b8b4240eef256d2fdbe672718506f29f5a20f61', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
+ # client_options: {ssl: {ca_path: '/etc/ssl/certs'}}
end
-
-# OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 72aca7e..dc18996 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
new file mode 100644
index 0000000..4415dc3
--- /dev/null
+++ b/config/initializers/new_framework_defaults.rb
@@ -0,0 +1,23 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 4f805f2..4f96656 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Debshots::Application.config.session_store :cookie_store, key: '_debshots_session'
+Rails.application.config.session_store :cookie_store, key: '_debshots_session'
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index 33725e9..bbfc396 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -5,10 +5,10 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+ wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
-# self.include_root_in_json = true
+# self.include_root_in_json = true
# end
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
index bd4c3eb..0b8f130 100644
--- a/config/locales/devise.en.yml
+++ b/config/locales/devise.en.yml
@@ -23,6 +23,8 @@ en:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock instructions"
+ email_changed:
+ subject: "Email Changed"
password_change:
subject: "Password Changed"
omniauth_callbacks:
diff --git a/config/routes.rb b/config/routes.rb
index a599aa5..abb6a74 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -7,8 +7,8 @@ Debshots::Application.routes.draw do
get 'admin/integration'
devise_for :users, controllers: {
- registrations: "users/registrations",
- passwords: "users/passwords",
+ # registrations: "users/registrations",
+ # passwords: "users/passwords",
omniauth_callbacks: "users/omniauth_callbacks"
}
diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb
new file mode 100644
index 0000000..8a8914c
--- /dev/null
+++ b/test/controllers/admin_controller_test.rb
@@ -0,0 +1,19 @@
+require "test_helper"
+
+describe AdminController do
+ it "should get status" do
+ get admin_status_url
+ value(response).must_be :success?
+ end
+
+ it "should get screenshots" do
+ get admin_screenshots_url
+ value(response).must_be :success?
+ end
+
+ it "should get integration" do
+ get admin_integration_url
+ value(response).must_be :success?
+ end
+
+end
diff --git a/test/controllers/my_controller_test.rb b/test/controllers/my_controller_test.rb
new file mode 100644
index 0000000..c242a33
--- /dev/null
+++ b/test/controllers/my_controller_test.rb
@@ -0,0 +1,14 @@
+require "test_helper"
+
+describe MyController do
+ it "should get index" do
+ get my_index_url
+ value(response).must_be :success?
+ end
+
+ it "should get uploads" do
+ get my_uploads_url
+ value(response).must_be :success?
+ end
+
+end