authentifyd 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +26 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/images/authentifyd/en.png +0 -0
  6. data/app/assets/images/authentifyd/facebook-logo.png +0 -0
  7. data/app/assets/images/authentifyd/fr.png +0 -0
  8. data/app/assets/images/authentifyd/google-logo.png +0 -0
  9. data/app/assets/images/authentifyd/signin_with_facebook.png +0 -0
  10. data/app/assets/images/authentifyd/signin_with_fb.png +0 -0
  11. data/app/assets/images/authentifyd/signin_with_google.png +0 -0
  12. data/app/assets/images/authentifyd/signin_with_twitter.png +0 -0
  13. data/app/assets/images/authentifyd/twitter-logo.png +0 -0
  14. data/app/assets/javascripts/authentifyd/application.js +15 -0
  15. data/app/assets/stylesheets/authentifyd/application.css +13 -0
  16. data/app/controllers/authentifyd/application_controller.rb +11 -0
  17. data/app/controllers/authentifyd/authentications_controller.rb +94 -0
  18. data/app/controllers/authentifyd/confirmations_controller.rb +5 -0
  19. data/app/controllers/authentifyd/passwords_controller.rb +4 -0
  20. data/app/controllers/authentifyd/registrations_controller.rb +42 -0
  21. data/app/controllers/authentifyd/sessions_controller.rb +13 -0
  22. data/app/controllers/authentifyd/unlocks_controller.rb +4 -0
  23. data/app/helpers/authentifyd/application_helper.rb +4 -0
  24. data/app/models/authentifyd.rb +5 -0
  25. data/app/models/authentifyd/authentication.rb +16 -0
  26. data/app/models/authentifyd/user.rb +66 -0
  27. data/app/views/authentifyd/authentications/_authentication.html.erb +15 -0
  28. data/app/views/authentifyd/authentications/index.html.erb +14 -0
  29. data/app/views/authentifyd/authentications/link.html.erb +14 -0
  30. data/app/views/authentifyd/confirmations/new.html.erb +25 -0
  31. data/app/views/authentifyd/devise/mailer/confirmation_instructions.html.erb +5 -0
  32. data/app/views/authentifyd/devise/mailer/reset_password_instructions.html.erb +8 -0
  33. data/app/views/authentifyd/devise/mailer/unlock_instructions.html.erb +7 -0
  34. data/app/views/authentifyd/devise/shared/_links.erb +30 -0
  35. data/app/views/authentifyd/layouts/_account_menu.html.haml +24 -0
  36. data/app/views/authentifyd/passwords/edit.html.erb +30 -0
  37. data/app/views/authentifyd/passwords/new.html.erb +27 -0
  38. data/app/views/authentifyd/registrations/_authentifyd_form.html.erb +52 -0
  39. data/app/views/authentifyd/registrations/edit.html.erb +1 -0
  40. data/app/views/authentifyd/registrations/new.html.erb +44 -0
  41. data/app/views/authentifyd/sessions/_social_networks.html.erb +23 -0
  42. data/app/views/authentifyd/sessions/new.html.erb +49 -0
  43. data/app/views/authentifyd/unlocks/new.html.erb +28 -0
  44. data/app/views/layouts/authentifyd/_navbar.html.haml +41 -0
  45. data/app/views/layouts/authentifyd/application.html.erb +19 -0
  46. data/config/initializers/devise.rb +3 -0
  47. data/config/initializers/omniauth.rb +119 -0
  48. data/config/locales/devise.en.yml +100 -0
  49. data/config/locales/devise.fr.yml +113 -0
  50. data/config/locales/en.yml +7 -0
  51. data/config/locales/fr.yml +7 -0
  52. data/config/routes.rb +30 -0
  53. data/db/migrate/20121120091659_create_authentifyd_users.rb +52 -0
  54. data/db/migrate/20121120091700_create_authentifyd_authentications.rb +11 -0
  55. data/db/migrate/20130827085250_add_language_to_user.rb +5 -0
  56. data/lib/authentifyd.rb +39 -0
  57. data/lib/authentifyd/engine.rb +16 -0
  58. data/lib/authentifyd/version.rb +3 -0
  59. data/lib/tasks/authentifyd_tasks.rake +4 -0
  60. metadata +256 -0
@@ -0,0 +1,14 @@
1
+ <%= render :layout => 'authentifyd/layouts/account_menu' do %>
2
+ <legend><%= t("Existing_linked_accounts") %></legend>
3
+ <div class='providers-list row-fluid'>
4
+ <%= render @authentications %>
5
+ </div>
6
+ <% if @authentications.empty? %>
7
+ <%= t("You_have_not_linked_any_account_yet") %>
8
+ <% end %>
9
+
10
+ </br>
11
+ </br>
12
+ <legend><%= t("Link_other_accounts") %></legend>
13
+ <%= render :partial => "authentifyd/sessions/social_networks" %>
14
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <div class="container main">
2
+ <div class="row-fluid">
3
+ <div id="allaround-wraper" class="big">
4
+ <h2><%= t('This_email_is_already_taken_Sign_in_to_link_these_accounts')%> </h2>
5
+
6
+ <%= form_for([:authentifyd, @user], :url => add_account_path(@user)) do |f| %>
7
+ <p><%= f.label :password%><br />
8
+ <%= f.password_field :password %></p>
9
+
10
+ <p><%= f.submit t("Sign_in") %></p>
11
+ <% end %>
12
+ </div>
13
+ </div>
14
+ </div>
@@ -0,0 +1,25 @@
1
+ <div class="container main">
2
+ <div id="allaround-wraper">
3
+ <div class="authentifyd-form">
4
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
5
+ <legend><%= t('Resend_confirmation_instructions') %></legend>
6
+ <%= devise_error_messages! %>
7
+
8
+ <div class="body">
9
+ <%= f.label :email, t('Email') %>
10
+ <%= f.email_field :email %>
11
+ </div>
12
+
13
+ <div class="footer">
14
+ <%= button_tag t("Send"), :type => "submit", :class => "btn btn-primary" %>
15
+ </div>
16
+
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+ <div class='row-fluid'>
21
+ <div class="devise-shared-links">
22
+ <%= render :partial => "authentifyd/devise/shared/links" %>
23
+ </div>
24
+ </div>
25
+ </div>
@@ -0,0 +1,5 @@
1
+ <p><%= t('Welcome') %><%= @resource.email %>!</p>
2
+
3
+ <p><%= t('You_can_confirm_your_account_email_through_the_link_below')</p>
4
+
5
+ <p><%= link_to t('Confirm_my_account'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -0,0 +1,8 @@
1
+ <p><%= t('Hello') %><%= @resource.email %>!</p>
2
+
3
+ <p><%= t("Someone_has_requested_a_link_to_change_your_password_and_you_can_do_this_through_the_link_below") %></p>
4
+
5
+ <p><%= link_to t('Change_my_password'), edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
+
7
+ <p><%= t('If_you_didnt_request_this_please_ignore_this_email') %> </p>
8
+ <p><%= t('Your_password_wont_change_until_you_access_the_link_above_and_create_a_new_one') %></p>
@@ -0,0 +1,7 @@
1
+ <p><%= t('Hello')%><%= @resource.email %>!</p>
2
+
3
+ <p><%= t('Your_account_has_been_locked_due_to_an_excessive_amount_of_unsuccessful_sign_in_attempts') %></p>
4
+
5
+ <p><%= t('Click_the_link_below_to_unlock_your_account') %></p>
6
+
7
+ <p><%= link_to t('Unlock_my_account'), unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -0,0 +1,30 @@
1
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
2
+ <%= link_to t('Forgot_your_password'), new_password_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' && !user_signed_in? %>
6
+ <%= link_to t("Didnt_receive_confirmation_instructions"), new_confirmation_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' && !user_signed_in? %>
10
+ <%= link_to t('Didnt_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.omniauthable? %>
14
+ <%- resource_class.omniauth_providers.each do |provider| %>
15
+ <%= link_to "#{t('Sign_in_with')} #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
16
+ <% end -%>
17
+ <% end -%>
18
+
19
+ <%- if controller_name != 'sessions' && !user_signed_in? %>
20
+ <br/>
21
+ <legend><%= t('Already_a_member') %></legend>
22
+ <%= link_to t("Sign_in"), new_session_path(resource_name), :class => "sign_in_link_in_links btn" %><br />
23
+ <% end -%>
24
+
25
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
26
+ <br/>
27
+ <legend><%= t('Not_already_a_member') %></legend>
28
+ <%= link_to t("Sign_up"), new_registration_path(resource_name), :class => "sign_up_link_in_links btn" %><br />
29
+ <% end -%>
30
+
@@ -0,0 +1,24 @@
1
+ .container.main
2
+ .row-fluid
3
+ #allaround-wraper.big
4
+ .row-fluid
5
+ .span4
6
+ .padded-right
7
+ %ul.padded-right.nav.nav-pills.nav-stacked
8
+ %li.nav-header
9
+ %legend= current_user.email
10
+ %ul.padded-horiz.nav.nav-pills.nav-stacked
11
+ - is_on_edit_account_page = controller_name == 'registrations' && action_name == 'edit'
12
+ %li{class: "#{is_on_edit_account_page ? 'active' : ''}"}
13
+ = link_to is_on_edit_account_page ? '#' : edit_user_registration_path do
14
+ %i.icon-edit
15
+ &nbsp;
16
+ = t('Edit_account')
17
+ - is_on_linked_accounts_page = controller_name == 'authentications' && action_name == 'index'
18
+ %li{class: "#{is_on_linked_accounts_page ? 'active' : ''}"}
19
+ = link_to is_on_linked_accounts_page ? '#' : accounts_path do
20
+ %i.icon-link.inline
21
+ &nbsp;
22
+ = t('Linked_accounts')
23
+ .span8
24
+ = yield
@@ -0,0 +1,30 @@
1
+ <div class="container main">
2
+ <div id="allaround-wraper">
3
+ <div class="authentifyd-form">
4
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
5
+ <legend><%= t('Change_your_password') %></legend>
6
+ <%= devise_error_messages! %>
7
+
8
+ <div class="body">
9
+ <%= f.hidden_field :reset_password_token %>
10
+
11
+ <%= f.label :password, t("New_password") %>
12
+ <%= f.password_field :password %>
13
+
14
+ <%= f.label :password_confirmation, t("Confirm_new_password") %>
15
+ <%= f.password_field :password_confirmation %>
16
+
17
+ </div>
18
+
19
+ <div class="footer">
20
+ <%= button_tag t("Change_my_password"), :type => "submit", :class => "btn btn-primary" %>
21
+ </div>
22
+
23
+ <% end %>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="devise-shared-links">
29
+ <%= render :partial => "authentifyd/devise/shared/links" %>
30
+ </div>
@@ -0,0 +1,27 @@
1
+ <div class="container main">
2
+ <div id="allaround-wraper">
3
+ <div class="authentifyd-form">
4
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
5
+ <legend><%= t('Forgot_your_password') %></legend>
6
+ <%= devise_error_messages! %>
7
+
8
+ <div class="body">
9
+
10
+ <%= f.label :email, t('Email') %>
11
+ <%= f.email_field :email %>
12
+
13
+ </div>
14
+
15
+ <div class="footer">
16
+ <%= button_tag t("Send_me_reset_password_instructions"), :type => "submit", :class => "btn btn-primary" %>
17
+ </div>
18
+
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ <div class='row-fluid'>
23
+ <div class="devise-shared-links">
24
+ <%= render :partial => "authentifyd/devise/shared/links" %>
25
+ </div>
26
+ </div>
27
+ </div>
@@ -0,0 +1,52 @@
1
+ <div class='authentifyd-form'>
2
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }, :class => "form register-form") do |f| %>
3
+ <legend>
4
+ <%= t('Edit_account') %>
5
+ </legend>
6
+ <%= devise_error_messages! %>
7
+
8
+ <div class="body">
9
+ <fieldset>
10
+ <%= f.label :email, t('Email') %>
11
+ <%= f.email_field :email %>
12
+ </fieldset>
13
+ <fieldset>
14
+ <%= f.label :password, t('Password') %> <i><%= t("leave_blank_if_you_dont_want_to_change_it") %></i>
15
+ <%= f.password_field :password %>
16
+
17
+ <%= f.label :password_confirmation, t('Password_confirmation') %>
18
+ <%= f.password_field :password_confirmation %>
19
+
20
+ <%= f.label :current_password, t('Current_password') %> <i><%= t("we_need_your_current_password_to_confirm_your_changes") %></i>
21
+ <%= f.password_field :current_password %>
22
+ </fieldset>
23
+ </div>
24
+
25
+ <div class="footer">
26
+ <%= button_tag t("Update"), :type => "submit", :class => "btn btn-primary" %>
27
+ </div>
28
+ <% end %>
29
+ <div class='row-fluid'>
30
+ <div class="devise-shared-links">
31
+ <%= render :partial => "authentifyd/devise/shared/links" %>
32
+ </div>
33
+ </div>
34
+
35
+ </br>
36
+ </br>
37
+ <div class="footer">
38
+ <%= link_to registration_path(resource_name), :confirm => t("Are_you_sure"), :method => :delete, class: 'btn btn-danger' do %>
39
+ <i class='icon-remove'></i>
40
+ &nbsp;
41
+ <%= t("Cancel_my_account") %>
42
+ <% end %>
43
+ </br>
44
+ </br>
45
+ </br>
46
+ <%= link_to :back do %>
47
+ <i class='icon-arrow-left'></i>
48
+ &nbsp;
49
+ <%= t("Back") %>
50
+ <% end %>
51
+ </div>
52
+ </div>
@@ -0,0 +1 @@
1
+ <%= render partial: 'authentifyd_form', layout: 'authentifyd/layouts/account_menu' %>
@@ -0,0 +1,44 @@
1
+ <div class="container main">
2
+ <div class="row-fluid">
3
+ <div id="register-wraper" class="span12">
4
+ <div class='span6 register-form-container'>
5
+ <div id="register-form">
6
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :class => "form register-form") do |f| %>
7
+ <legend><%= t('Sign_up_with_your_email') %></legend>
8
+ <%= devise_error_messages! %>
9
+
10
+ <div class="body">
11
+ <%= f.label :email, t('Email') %>
12
+ <%= f.email_field :email %>
13
+
14
+ <%= f.label :password, t('Password') %>
15
+ <%= f.password_field :password %>
16
+
17
+ <%= f.label :password_confirmation, t('Password_confirmation') %>
18
+ <%= f.password_field :password_confirmation %>
19
+ </div>
20
+
21
+ <div class="footer">
22
+ <%= button_tag t("Sign_up"), :type => "submit", :class => "btn btn-primary" %>
23
+ </div>
24
+
25
+ <% end %>
26
+ </div>
27
+ </div>
28
+ <div class='span1'> </div>
29
+ <div class='span5 register-providers-container'>
30
+ <div class="login-form">
31
+ <legend><%= t('or_use_your_prefered_profile')%></legend>
32
+ <div class="body">
33
+ <%= render :partial => "authentifyd/sessions/social_networks" %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div class='row-fluid'>
40
+ <div class="devise-shared-links">
41
+ <%= render :partial => "authentifyd/devise/shared/links" %>
42
+ </div>
43
+ </div>
44
+ </div>
@@ -0,0 +1,23 @@
1
+ <div>
2
+ <% if defined?(TWITTER) && user_signed_in? %>
3
+ <% unless user_signed_in? && current_user.authentications.map(&:provider).include?('twitter') %>
4
+ <%= link_to image_tag("authentifyd/signin_with_twitter.png", :alt => "Twitter"), '/auth/twitter' %>
5
+ <% end %>
6
+ </br>
7
+ </br>
8
+ <% end %>
9
+ <% if defined?(FACEBOOK)%>
10
+ <% unless user_signed_in? && current_user.authentications.map(&:provider).include?('facebook') %>
11
+ <%= link_to image_tag("authentifyd/signin_with_fb.png", :alt => "Facebook"), '/auth/facebook' %>
12
+ <% end %>
13
+ </br>
14
+ </br>
15
+ <% end %>
16
+ <% if defined?(GOOGLE)%>
17
+ <% unless user_signed_in? && current_user.authentications.map(&:provider).include?('google_oauth2') %>
18
+ <%= link_to image_tag("authentifyd/signin_with_google.png", :alt => "Google", width: '287' ), '/auth/google_oauth2'%>
19
+ <% end %>
20
+ </br>
21
+ </br>
22
+ <% end %>
23
+ </div>
@@ -0,0 +1,49 @@
1
+ <div class="container main">
2
+
3
+ <div class="row-fluid">
4
+ <div id="login-wraper" class="span12">
5
+ <div class='span6 login-form-container'>
6
+ <div class="login-form">
7
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :class => "form login-form") do |f| %>
8
+ <legend><%= t('Sign_in_with_your_email') %></legend>
9
+ <%= devise_error_messages! %>
10
+
11
+ <div class="body">
12
+ <%= f.label :email, t('Email') %>
13
+ <%= f.email_field :email %>
14
+
15
+ <%= f.label :password, t('Password') %>
16
+ <%= f.password_field :password %>
17
+ </div>
18
+
19
+ <div class="footer">
20
+ <% if devise_mapping.rememberable? -%>
21
+ <%= f.label :remember_me, t('Remember_me'), :class => "checkbox inline" do %>
22
+ <%= f.check_box :remember_me, :id => "inlineCheckbox1" %><%= t('Remember_me') %>
23
+ <% end %>
24
+ <% end %>
25
+ </br>
26
+ </br>
27
+ <%= button_tag t("Sign_in"), :type => "submit", :class => "btn btn-primary" %>
28
+ </div>
29
+
30
+ <% end %>
31
+ </div>
32
+ </div>
33
+ <div class='span1'></div>
34
+ <div class='span5 login-providers-container'>
35
+ <div class="login-form">
36
+ <legend><%= t('or_use_your_prefered_profile')%></legend>
37
+ </div>
38
+ <div class="body">
39
+ <%= render :partial => "social_networks" %>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <div class='row-fluid'>
45
+ <div class="devise-shared-links">
46
+ <%= render :partial => "authentifyd/devise/shared/links" %>
47
+ </div>
48
+ </div>
49
+ </div>
@@ -0,0 +1,28 @@
1
+ <div class="container main">
2
+ <div id="allaround-wraper">
3
+ <div class="authentifyd-form">
4
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
5
+ <legend><%= t('Resend_unlock_instructions?') %></legend>
6
+ <%= devise_error_messages! %>
7
+
8
+ <div class="body">
9
+
10
+ <%= f.label :email, t('Email') %>
11
+ <%= f.email_field :email %>
12
+
13
+ </div>
14
+
15
+ <div class="footer">
16
+ <%= button_tag t("Send"), :type => "submit", :class => "btn btn-primary" %>
17
+ </div>
18
+
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ <div class='row-fluid'>
23
+ <div class="devise-shared-links">
24
+ <%= render :partial => "authentifyd/devise/shared/links" %>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
@@ -0,0 +1,41 @@
1
+ #header.navbar
2
+ .navbar-inner.clearfix
3
+ .container-fluid
4
+ %ul.sign_in_block.nav.navbar-nav
5
+ - if user_signed_in?
6
+ %li.dropdown.pull-right
7
+ = link_to"#", class:"dropdown-toggle", id:"dLabel", role:"button", :'data-toggle'=>"dropdown", :'data-target'=>"#" do
8
+ = current_user.email
9
+ &nbsp;
10
+ %i.icon-caret-down.inline
11
+ %ul.dropdown-menu{role:"menu", :'aria-labelledby'=>"dLabel"}
12
+ %li
13
+ = link_to edit_user_registration_path, class: 'btn no_btn' do
14
+ %i.icon-cog.inline
15
+ &nbsp;
16
+ = t('My_account')
17
+ %li
18
+ = link_to accounts_path, class: 'btn no_btn' do
19
+ %i.icon-link.inline
20
+ &nbsp;
21
+ = t('Linked_accounts')
22
+ %li
23
+ = link_to destroy_session_path(:user), class: 'btn no_btn' do
24
+ %i.icon-signout.inline
25
+ &nbsp;
26
+ = t('Sign_out')
27
+ - else
28
+ %li.pull-right
29
+ = link_to new_session_path(:user), class: 'btn no_btn icon_btn' do
30
+ %i.icon-user.icon-4x
31
+ = t('Connect')
32
+ %li#authentifyd_language_selector.dropdown.pull-right
33
+ = link_to "#", class:"dropdown-toggle", id:"dLabel", role:"button", :'data-toggle'=>"dropdown", :'data-target'=>"#" do
34
+ = image_tag "authentifyd/#{I18n.locale}.png", width: '15'
35
+ %ul.dropdown-menu{role:"menu", :'aria-labelledby'=>"dLabel"}
36
+ - I18n.available_locales.select{|ll| ll != I18n.locale }.each do |l|
37
+ %li
38
+ = link_to url_for(params.merge(locale: l)), class: 'btn no_btn' do
39
+ = image_tag "authentifyd/#{l}.png", width: '15'
40
+
41
+ = Authentifyd.top_navbar_snippet.try(:call).try(:html_safe)