implement openID authentication

This commit is contained in:
Stella Rouzi 2014-06-18 16:58:30 +03:00
parent 37e026a9fb
commit 600adde6ba
23 changed files with 408 additions and 14 deletions

View file

@ -15,6 +15,18 @@
%br
%br
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
= f.inputs :name => 'OpenID' do
%h4
Currently using the following openIDs:
- @openids.each do |openid|
= openid.provider
= openid.email
%br
%h4
To add an openID to your account using a different email address, sign in with your
openID while logged in to OSEM
= render 'devise/shared/openid'
= f.inputs :name => "Account" do
= f.input :email, :required => false
= f.input :password, :hint => "(Leave blank if you don't want to change it)", :input_html => {:autocomplete => "off"}

View file

@ -3,13 +3,17 @@
%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|
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= f.input :email
= f.input :password
= f.input :password_confirmation
= f.action :submit, :as => :button, :label => "Sign Up", :button_html => {:class => "btn btn-primary"}
.col-md-3.col-md-offset-2
= 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'
.col-md-4
.well
%h4
Already have an account?
= render "devise/shared/links"
%h4 Or use your openID
= render 'devise/shared/openid'

View file

@ -0,0 +1,21 @@
.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"
.col-md-4
.well
%h4 Or use your openID
= render 'devise/shared/openid'

View file

@ -0,0 +1,19 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Sign in", new_user_session_path %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% 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) %><br />
<% end -%>

View file

@ -0,0 +1,4 @@
- if devise_mapping.omniauthable?
- resource_class.omniauth_providers.each do |provider|
= link_to image_tag("#{provider}.png", size: '32x32') + provider , omniauth_authorize_path(resource_name, provider)
%br