diff --git a/app/assets/images/facebook.png b/app/assets/images/facebook.png
deleted file mode 100644
index e8bca65f..00000000
Binary files a/app/assets/images/facebook.png and /dev/null differ
diff --git a/app/assets/images/google.png b/app/assets/images/google.png
deleted file mode 100644
index 3909e9de..00000000
Binary files a/app/assets/images/google.png and /dev/null differ
diff --git a/app/assets/images/novell.png b/app/assets/images/novell.png
deleted file mode 100644
index a33e55e2..00000000
Binary files a/app/assets/images/novell.png and /dev/null differ
diff --git a/app/assets/images/suse.svg b/app/assets/images/suse.svg
new file mode 100644
index 00000000..ab3061dc
--- /dev/null
+++ b/app/assets/images/suse.svg
@@ -0,0 +1,104 @@
+
+
+
+
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 50504034..dac9aa07 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -10,6 +10,7 @@
*= require osem-schedule
*= require osem-schedule-print
*= require osem-dashboard
+ *= require osem-fonts
*= require font-awesome
*= require bootstrap-markdown.min
*/
diff --git a/app/assets/stylesheets/fonts/suse-icons.eot b/app/assets/stylesheets/fonts/suse-icons.eot
new file mode 100644
index 00000000..ffed3026
Binary files /dev/null and b/app/assets/stylesheets/fonts/suse-icons.eot differ
diff --git a/app/assets/stylesheets/fonts/suse-icons.svg b/app/assets/stylesheets/fonts/suse-icons.svg
new file mode 100644
index 00000000..72c938a4
--- /dev/null
+++ b/app/assets/stylesheets/fonts/suse-icons.svg
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/assets/stylesheets/fonts/suse-icons.ttf b/app/assets/stylesheets/fonts/suse-icons.ttf
new file mode 100644
index 00000000..ef1de507
Binary files /dev/null and b/app/assets/stylesheets/fonts/suse-icons.ttf differ
diff --git a/app/assets/stylesheets/fonts/suse-icons.woff b/app/assets/stylesheets/fonts/suse-icons.woff
new file mode 100644
index 00000000..4ebb0dc1
Binary files /dev/null and b/app/assets/stylesheets/fonts/suse-icons.woff differ
diff --git a/app/assets/stylesheets/osem-fonts.css b/app/assets/stylesheets/osem-fonts.css
new file mode 100644
index 00000000..0864ce30
--- /dev/null
+++ b/app/assets/stylesheets/osem-fonts.css
@@ -0,0 +1,47 @@
+/* Generated with http://fontastic.me/ and app/assets/images/suse.svg */
+@charset "UTF-8";
+
+@font-face {
+ font-family: "suse-icons";
+ src:url("fonts/suse-icons.eot");
+ src:url("fonts/suse-icons.eot?#iefix") format("embedded-opentype"),
+ url("fonts/suse-icons.woff") format("woff"),
+ url("fonts/suse-icons.ttf") format("truetype"),
+ url("fonts/suse-icons.svg#suse-icons") format("svg");
+ font-weight: normal;
+ font-style: normal;
+
+}
+
+[data-icon]:before {
+ font-family: "suse-icons" !important;
+ content: attr(data-icon);
+ font-style: normal !important;
+ font-weight: normal !important;
+ font-variant: normal !important;
+ text-transform: none !important;
+ speak: none;
+ line-height: 1;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+/* We have to repeat this for every symbol that extends font awesome. So if
+ you add fa-rutzelfuz you need to copy and paste these two...
+*/
+[class^="fa-suse"]:before,
+[class*=" fa-suse"]:before {
+ font-family: "suse-icons" !important;
+ font-style: normal !important;
+ font-weight: normal !important;
+ font-variant: normal !important;
+ text-transform: none !important;
+ speak: none;
+ line-height: 1;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.fa-suse:before {
+ content: "a";
+}
diff --git a/app/assets/stylesheets/osem.css b/app/assets/stylesheets/osem.css.scss
similarity index 99%
rename from app/assets/stylesheets/osem.css
rename to app/assets/stylesheets/osem.css.scss
index 7ad9dba9..d64a4776 100644
--- a/app/assets/stylesheets/osem.css
+++ b/app/assets/stylesheets/osem.css.scss
@@ -120,4 +120,4 @@ body {
.pad{
padding-top: 35px;
padding-bottom: 35px;
-}
+}
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 7ca2a022..04ac8a88 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -210,4 +210,16 @@ module ApplicationHelper
def markdown_hint(text="")
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text")
end
+
+ def omniauth_configured
+ providers = []
+ Devise.omniauth_providers.each do |provider|
+ provider_key = "#{provider}_key"
+ provider_secret = "#{provider}_secret"
+ unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
+ providers << provider
+ end
+ end
+ return providers
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index c86c773e..afcce0b4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -7,7 +7,7 @@ class User < ActiveRecord::Base
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
- :omniauthable, omniauth_providers: [:novell, :google, :facebook]
+ :omniauthable, omniauth_providers: [:suse, :google, :facebook]
has_and_belongs_to_many :roles
has_many :openids
diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml
index c2b89f82..b7714d18 100644
--- a/app/views/devise/registrations/edit.html.haml
+++ b/app/views/devise/registrations/edit.html.haml
@@ -23,7 +23,8 @@
%h4
To add an openID with a different email address to your account, sign in with your
openID while logged in to OSEM
- = render 'devise/shared/openid'
+ #openidlinks
+ = render 'devise/shared/openid'
= f.inputs name: 'Account' do
= f.input :email, required: false, input_html: {autocomplete: "off"}
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index 8c4af033..233d62f2 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -1,21 +1,32 @@
.row
- .page-header
- %h1.text-center Sign Up
- .col-md-5.col-md-offset-1
- .well
- = semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
- = f.input :email
- = f.input :name, required: true
- = f.input :password
- = f.input :password_confirmation
- = f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-primary'}
- %br
- %br
- %h4 Already have an account?
- = render 'devise/shared/links'
- - if resource_class.omniauth_providers.present?
- .col-md-4
- .well
- %h4 Or use your openID
-
- = render 'devise/shared/openid'
+ .col-md-6.col-md-offset-3
+ .panel.panel-default
+ .panel-heading
+ %h3.panel-title
+ Sign Up
+ .panel-body
+ = semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
+ = f.input :email
+ = f.input :name, required: true
+ = f.input :password
+ = f.input :password_confirmation
+ %p.text-right
+ = f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-success' }
+ - unless omniauth_configured.empty?
+ .row
+ .col-md-4
+ %hr
+ .col-md-4
+ %h4.text-center
+ or sign up using
+ .col-md-4
+ %hr
+ .row
+ .col-md-12
+ #openidlinks
+ = render 'devise/shared/openid'
+ %p.text-right
+ %a.small{"data-toggle" => "collapse", "data-target" => "#devise-help"}
+ Need Help?
+ #devise-help.collapse
+ = render 'devise/shared/links'
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index 80d78201..11f55860 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,22 +1,34 @@
.row
- .page-header
- %h2.text-center Sign In
- .col-md-5.col-md-offset-1
- .well
- = semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
- = f.input :email
- = f.input :password
- - if devise_mapping.rememberable?
- = f.check_box :remember_me
- = f.label 'Remember me'
- %br
- = f.action :submit, as: :button, label: 'Sign In', button_html: {class: 'btn btn-primary'}
- %br
- %br
- = render "devise/shared/links"
-
- - if resource_class.omniauth_providers.present?
- .col-md-4
- .well
- %h4 Or use your openID
- = render 'devise/shared/openid'
+ .col-md-6.col-md-offset-3
+ .panel.panel-default
+ .panel-heading
+ %h3.panel-title
+ Sign In
+ .panel-body
+ = semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
+ = f.input :email
+ = f.input :password
+ - if devise_mapping.rememberable?
+ %p.text-right.small
+ = f.label 'Remember me'
+ = f.check_box :remember_me
+ %p.text-right
+ = f.action :submit, as: :button, label: 'Sign In', button_html: {class: 'btn btn-success'}
+ - unless omniauth_configured.empty?
+ .row
+ .col-md-4
+ %hr
+ .col-md-4
+ %h4.text-center
+ or sign in using
+ .col-md-4
+ %hr
+ .row
+ .col-md-12
+ #openidlinks
+ = render 'devise/shared/openid'
+ %p.text-right
+ %a.small{"data-toggle" => "collapse", "data-target" => "#devise-help"}
+ Need Help?
+ #devise-help.collapse
+ = render 'devise/shared/links'
diff --git a/app/views/devise/shared/_links.html.haml b/app/views/devise/shared/_links.html.haml
index feca9d4d..b320965b 100644
--- a/app/views/devise/shared/_links.html.haml
+++ b/app/views/devise/shared/_links.html.haml
@@ -1,16 +1,8 @@
-- if controller_name != 'sessions'
- = link_to "Sign in", new_user_session_path
- %br
-
-- if devise_mapping.registerable? && controller_name != 'registrations'
- = link_to "Sign up", new_registration_path(resource_name)
- %br
-
-- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
+- if devise_mapping.recoverable? && controller_name != 'passwords'
= link_to "Forgot your password?", new_password_path(resource_name)
%br
-- if devise_mapping.confirmable? && controller_name != 'confirmations'
+- if devise_mapping.confirmable? && controller_name != 'confirmations' && controller_name == 'passwords'
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
%br
diff --git a/app/views/devise/shared/_openid.html.haml b/app/views/devise/shared/_openid.html.haml
index 5d1e6300..64f5f72a 100644
--- a/app/views/devise/shared/_openid.html.haml
+++ b/app/views/devise/shared/_openid.html.haml
@@ -1,7 +1,7 @@
-- if devise_mapping.omniauthable?
- - resource_class.omniauth_providers.each do |provider|
- - provider_key = "#{provider}_key"
- - provider_secret = "#{provider}_secret"
- - unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
- = link_to image_tag("#{provider}.png", size: '32x32') + provider , omniauth_authorize_path(resource_name, provider)
- %br
+.btn-group.btn-group-lg
+ - omniauth_configured.each do |provider|
+ = link_to user_omniauth_authorize_path(provider),
+ class: "btn btn-success btn-lg",
+ id: "omniauth-#{provider}",
+ title: "Your #{provider} login" do
+ %i{:class => "fa fa-#{provider}"}
\ No newline at end of file
diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml
index 31065a46..3b200e11 100644
--- a/app/views/layouts/_navigation.html.haml
+++ b/app/views/layouts/_navigation.html.haml
@@ -36,26 +36,29 @@
= link_to(new_registration_path('user')) do
%span.glyphicon.glyphicon-heart
Sign Up
- %li.dropdown.visible-desktop
- %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
- %span.glyphicon.glyphicon-user
- Sign In
- %span.caret
- .dropdown-menu{:style => "padding: 17px;"}
- = form_tag user_session_path do
- = text_field_tag 'user[email]', nil, id: 'user_email_dd'
- = password_field_tag 'user[password]', nil, id: 'user_password_dd'
- %p.text-right
- %small
- Remember me
- = check_box_tag 'user[remember_me]'
- %button.btn.btn-success.btn-block Sign in
- %p
- %small
- %ul.list-unstyled
- %li
- = link_to "Forgot your password?", new_password_path('user')
- %li
- = link_to 'Sign in with openID', new_user_session_path
+ %li.dropdown.visible-desktop
+ %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
+ %span.glyphicon.glyphicon-user
+ Sign In
+ %span.caret
+ .dropdown-menu{:style => "padding: 17px;"}
+ = form_tag user_session_path do
+ = text_field_tag 'user[email]', nil, id: 'user_email_dd'
+ = password_field_tag 'user[password]', nil, id: 'user_password_dd'
+ %p.text-right
+ %small
+ Remember me
+ = check_box_tag 'user[remember_me]'
+ %button.btn.btn-success.btn-block Sign in
+ - unless omniauth_configured.empty?
+ .divider
+ %h6.text-center
+ or
+ = render 'devise/shared/openid'
+ %p.text-right
+ %a.small{"data-toggle" => "collapse", "data-target" => "#navbar-devise-help"}
+ Need Help?
+ #navbar-devise-help.collapse
+ = link_to "Forgot your password?", new_password_path(User.new)
%li.hidden-lg
= link_to('Sign In', new_user_session_path)
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 99546161..1caa0d05 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -9,10 +9,10 @@ Devise.setup do |config|
# Define the available openID providers that can be used to log in
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
- config.omniauth :open_id, name: 'novell', identifier: 'http://www.opensuse.org/openid/user'
- config.omniauth :google_oauth2, Rails.application.secrets.google_key, Rails.application.secrets.google_secret,
+ config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
+ config.omniauth :google_oauth2, Rails.application.secrets.google_key, Rails.application.secrets.google_secret,
name: 'google',
- scope: 'email'
+ scope: 'email'
config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret
# ==> Mailer Configuration
diff --git a/config/secrets.yml.example b/config/secrets.yml.example
index 0671fb71..068526b6 100644
--- a/config/secrets.yml.example
+++ b/config/secrets.yml.example
@@ -23,11 +23,10 @@ defaults: &defaults
facebook_key: ''
facebook_secret: ''
- # Developers do not need to register their application for novell account to work.
+ # Developers do not need to register their application for suse account to work.
# You must, however, leave the sample data there, for the login option to appear.
-
- novell_key: 'sample data'
- novell_secret: 'sample data'
+ suse_key: 'sample data'
+ suse_secret: 'sample data'
# If you add more providers that do not require a key, you still have to create the 2 variables with sample data
diff --git a/spec/features/omniauth_spec.rb b/spec/features/omniauth_spec.rb
index 89ef91c6..41cbb76e 100644
--- a/spec/features/omniauth_spec.rb
+++ b/spec/features/omniauth_spec.rb
@@ -8,8 +8,8 @@ feature Openid do
scenario 'has option to log in with Google account' do
visit '/accounts/sign_in'
- expect(page.has_content?('Or use your openID')).to be true
- expect(page.has_content?('google')).to be true
+ expect(page.has_content?('or sign in using')).to be true
+ expect(page.has_link?('omniauth-google')).to be true
end
scenario 'signs in *new* user with Google account' do
@@ -18,7 +18,9 @@ feature Openid do
visit '/accounts/sign_in'
mock_auth_new_user
- click_link 'google'
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
expect(flash).to eq('test-1@gmail.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@@ -31,7 +33,9 @@ feature Openid do
visit '/accounts/sign_in'
mock_auth_existing_user_participant
- click_link 'google'
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@@ -40,8 +44,11 @@ feature Openid do
scenario 'can handle authentication error' do
OmniAuth.config.mock_auth[:google] = :invalid_credentials
visit '/accounts/sign_in'
- expect(page.has_content?('Or use your openID')).to be true
- click_link 'google'
+ expect(page.has_content?('or sign in using')).to be true
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
+
expect(flash).to eq("Could not authenticate you from Google because \"Invalid credentials\".")
end
@@ -56,7 +63,9 @@ feature Openid do
visit '/accounts/edit'
mock_auth_new_user
- click_link 'google'
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@@ -71,7 +80,9 @@ feature Openid do
visit '/accounts/sign_in'
mock_auth_existing_user_participant
- click_link 'google'
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@@ -82,7 +93,9 @@ feature Openid do
visit '/accounts/edit'
mock_auth_new_user
- click_link 'google'
+ within("#openidlinks") do
+ click_link 'omniauth-google'
+ end
expect(flash).to eq('test-participant-1@google.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
@@ -96,7 +109,9 @@ feature Openid do
visit '/accounts/sign_in'
mock_auth_new_user_fb
- click_link 'facebook'
+ within("#openidlinks") do
+ click_link 'omniauth-facebook'
+ end
expect(flash).to eq('test-participant-1@google.com signed in successfully with facebook')
expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user)
diff --git a/spec/support/omniauth_macros.rb b/spec/support/omniauth_macros.rb
index 64196bc2..76351686 100644
--- a/spec/support/omniauth_macros.rb
+++ b/spec/support/omniauth_macros.rb
@@ -26,7 +26,7 @@ module OmniauthMacros
def mock_auth_new_user_fb
OmniAuth.config.mock_auth[:facebook] =
OmniAuth::AuthHash.new(
- provider: 'google',
+ provider: 'facebook',
uid: 'facebook-test-uid-1',
info: {
name: 'new user fb name',
diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb
new file mode 100644
index 00000000..8ff680cd
--- /dev/null
+++ b/spec/support/save_feature_failures.rb
@@ -0,0 +1,18 @@
+# Automatically save and open the page
+# whenever an expectation is not met in a features spec
+RSpec.configure do |config|
+ config.after(:each, type: :feature) do
+ ename = RSpec.current_example.full_description
+ ename = ename.gsub " ", "_"
+ ename.downcase!
+ ename = ename + ".html"
+ if RSpec.current_example.exception.present?
+ save_page(ename)
+ else
+ capfile = File.expand_path(ename, Capybara.save_and_open_page_path)
+ if File.exist?(capfile)
+ File.unlink(capfile)
+ end
+ end
+ end
+end