Merge pull request #528 from ChrisBr/devise
Implements iChain authentication
This commit is contained in:
commit
79de791f22
24 changed files with 305 additions and 136 deletions
|
|
@ -1,35 +1,25 @@
|
|||
%h1 Edit your Account
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
|
||||
= f.inputs name: 'Profile' do
|
||||
= f.input :name, as: :string
|
||||
= f.input :nickname, as: :string
|
||||
= f.input :affiliation, as: :string,
|
||||
hint: 'This could be a company, a user group, or nothing at all.'
|
||||
= f.input :biography, input_html: {rows: 5,
|
||||
'onkeyup' => "word_count(this, 'biography-count', 150)"}
|
||||
You have used
|
||||
%span#biography-count #{current_user.biography_word_count}
|
||||
words. Biographies are limited to 150 words.
|
||||
%br
|
||||
%br
|
||||
= f.inputs name: 'Account' do
|
||||
= f.input :username, required: false, input_html: { autocomplete: 'off' }
|
||||
= f.input :email, required: false, input_html: { autocomplete: 'off' }
|
||||
= f.input :password, hint: "(Leave blank if you don't want to change it)", input_html: { autocomplete: 'off' }
|
||||
= f.input :password_confirmation, input_html: { autocomplete: 'off' }
|
||||
= f.inputs name: 'OpenID' do
|
||||
%h4
|
||||
Currently the following openIDs are associated with your account
|
||||
- @openids.each do |openid|
|
||||
%li= "#{openid.provider}:#{openid.email}"
|
||||
%br
|
||||
%h4
|
||||
To add an openID with a different email address to your account, sign in with your
|
||||
openID while logged in to OSEM
|
||||
- if User.omniauth_providers.present?
|
||||
%h4
|
||||
To add an openID with a different email address to your account, sign in with your
|
||||
openID while logged in to OSEM
|
||||
#openidlinks
|
||||
= render 'devise/shared/openid'
|
||||
|
||||
= f.inputs name: 'Account' do
|
||||
= f.input :email, required: false, input_html: {autocomplete: "off"}
|
||||
= f.input :password, hint: "(Leave blank if you don't want to change it)", input_html: {autocomplete: 'off'}
|
||||
= f.input :password_confirmation, input_html: {autocomplete: 'off'}
|
||||
= f.inputs name: 'Confirmation' do
|
||||
= f.input :current_password, input_html: {autocomplete: 'off'},
|
||||
hint: '(we need your current password to confirm password or email changes)'
|
||||
= f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
hint: '(we need your current password to confirm password, email or username changes)'
|
||||
= f.action :submit, as: :button, label: 'Update Account', button_html: {class: 'btn btn-primary'}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
Sign Up
|
||||
.panel-body
|
||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||
= f.input :username, required: true
|
||||
= f.input :email
|
||||
= f.input :name, required: true
|
||||
= f.input :password
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
Sign In
|
||||
.panel-body
|
||||
= semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
||||
= f.input :email
|
||||
= f.input :login
|
||||
= f.input :password
|
||||
- if devise_mapping.rememberable?
|
||||
%p.text-right.small
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
%ul.nav.navbar-nav.navbar-right
|
||||
%li.dropdown
|
||||
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "current-user-detail"}
|
||||
- if not current_user.name.empty?
|
||||
- if not current_user.name.blank?
|
||||
#{current_user.name}
|
||||
-else
|
||||
#{current_user.email}
|
||||
|
|
@ -26,13 +26,13 @@
|
|||
= render 'layouts/user_menu'
|
||||
- else
|
||||
%ul.nav.navbar-nav.navbar-right
|
||||
- if current_page?(new_registration_path('user'))
|
||||
%li.active
|
||||
= link_to(new_registration_path('user')) do
|
||||
- if CONFIG['authentication']['ichain']['enabled']
|
||||
%li{:class=> "#{active_nav_li(new_ichain_registration_path('user'))}"}
|
||||
= link_to(new_ichain_registration_path('user')) do
|
||||
%span.fa.fa-heart
|
||||
Sign Up
|
||||
- else
|
||||
%li
|
||||
%li{:class=> "#{active_nav_li(new_registration_path('user'))}"}
|
||||
= link_to(new_registration_path('user')) do
|
||||
%span.fa.fa-heart
|
||||
Sign Up
|
||||
|
|
@ -42,23 +42,29 @@
|
|||
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)
|
||||
- if CONFIG['authentication']['ichain']['enabled']
|
||||
= form_tag new_user_ichain_session_path do
|
||||
= text_field_tag 'username', nil, id: 'user_ichain_email_dd'
|
||||
= password_field_tag 'password', nil, id: 'user_ichain_password_dd'
|
||||
%button.btn.btn-success.btn-block Sign in
|
||||
- else
|
||||
= form_tag new_user_session_path do
|
||||
= text_field_tag 'user[login]', nil, id: 'user_login_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)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,26 @@
|
|||
- unless CONFIG['authentication']['ichain']['enabled']
|
||||
%li
|
||||
= link_to(edit_user_registration_path) do
|
||||
%span.fa.fa-wrench
|
||||
Edit Account
|
||||
%li
|
||||
= link_to(edit_user_registration_path) do
|
||||
%span.fa.fa-wrench
|
||||
Edit Account
|
||||
= link_to(edit_user_path(current_user.id)) do
|
||||
%span.fa.fa-user
|
||||
Edit Profil
|
||||
-if @conference and @conference.id
|
||||
%li
|
||||
= link_to(conference_proposal_index_path(@conference.short_title)) do
|
||||
%span.fa.fa-comment
|
||||
My Submissions
|
||||
%li
|
||||
= link_to(destroy_user_session_path, :method=>'delete') do
|
||||
%span.fa.fa-minus
|
||||
Sign out
|
||||
- if CONFIG['authentication']['ichain']['enabled']
|
||||
= link_to(destroy_user_ichain_session_path, :method=>'delete') do
|
||||
%span.fa.fa-minus
|
||||
Sign out
|
||||
- else
|
||||
= link_to(destroy_user_session_path, :method=>'delete') do
|
||||
%span.fa.fa-minus
|
||||
Sign out
|
||||
- if can? :index, Conference
|
||||
%li.divider
|
||||
%li
|
||||
|
|
|
|||
17
app/views/users/edit.html.haml
Normal file
17
app/views/users/edit.html.haml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
%h1 Edit your profile
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(@user, url: user_path(@user.id)) do |f|
|
||||
= f.inputs name: 'Profile' do
|
||||
= f.input :name, as: :string
|
||||
= f.input :nickname, as: :string
|
||||
= f.input :affiliation, as: :string,
|
||||
hint: 'This could be a company, a user group, or nothing at all.'
|
||||
= f.input :biography, input_html: { rows: 5, 'onkeyup' => "word_count(this, 'biography-count', 150)" }
|
||||
You have used
|
||||
%span#bio_length
|
||||
0
|
||||
words. Biographies are limited to 150 words.
|
||||
%br
|
||||
%br
|
||||
= f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
16
app/views/users/show.html.haml
Normal file
16
app/views/users/show.html.haml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
%h1
|
||||
= @user.name
|
||||
%h4
|
||||
= @user.biography
|
||||
|
||||
- if @user.events.confirmed.any?
|
||||
%h3
|
||||
= "#{@user.name} presents #{pluralize(@user.events.confirmed.count, 'Event')}:"
|
||||
%ul.list-unstyled
|
||||
- @user.events.confirmed.each do |event|
|
||||
%li
|
||||
%h4
|
||||
= link_to event.title, conference_proposal_path(event.conference.short_title, event.id)
|
||||
%strong
|
||||
at
|
||||
= event.conference.title
|
||||
Loading…
Add table
Add a link
Reference in a new issue