From f296d27648aaac30794591e33094720d9f029089 Mon Sep 17 00:00:00 2001 From: jdamick Date: Mon, 18 Jun 2012 11:40:14 -0400 Subject: [PATCH] moved the ldap login to its own partial and cleaned up the forms a little bit --- app/views/devise/sessions/_new_ldap.html.erb | 40 +++++++++++++++ app/views/devise/sessions/new.html.erb | 53 ++++++-------------- 2 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 app/views/devise/sessions/_new_ldap.html.erb diff --git a/app/views/devise/sessions/_new_ldap.html.erb b/app/views/devise/sessions/_new_ldap.html.erb new file mode 100644 index 00000000..bfeec859 --- /dev/null +++ b/app/views/devise/sessions/_new_ldap.html.erb @@ -0,0 +1,40 @@ +<%#= form_for(resource, :as => resource_name, :url => user_omniauth_callback_path(:ldap), :html => { :class => "login-box", :id => 'new_ldap_user' }) do |f| %> +<%= form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do %> + <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %> + + <%= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} %> + <%= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %> + +
+ <%= submit_tag "LDAP Sign in", :class => "primary btn" %> + + <%- if devise_mapping.omniauthable? %> + <%- (resource_class.omniauth_providers - [:ldap]).each do |provider| %> +
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %>
+ <% end -%> + <% end -%> + +
+ Other Sign in + + +<% end %> + + +<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %> + <%= f.text_field :email, :class => "text top", :placeholder => "Email" %> + <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %> + + <% if devise_mapping.rememberable? -%> +
+ <% end -%> +
+ <%= f.submit "Sign in", :class => "primary btn" %> +
<%= render :partial => "devise/shared/links" %>
+ +<% end %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 89b2569d..a0383866 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,48 +1,27 @@ -<% if ldap_enable? -%> - <%= form_for(resource, :as => resource_name, :url => user_omniauth_callback_path(:ldap), :html => { :class => "login-box", :id => 'new_ldap_user' }) do |f| %> +<% unless ldap_enable? -%> + + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %> <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %> - <%= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} %> - <%= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %> + <%= f.text_field :email, :class => "text top", :placeholder => "Email" %> + <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %> <% if devise_mapping.rememberable? -%>
<% end -%>
- <%= f.submit "LDAP Sign in", :class => "primary btn" %> -
- Admin Sign in - - - <% end %> -<% end %> + <%= f.submit "Sign in", :class => "primary btn" %> +
<%= render :partial => "devise/shared/links" %>
-<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %> - <% unless ldap_enable? %> - <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %> - <% else %> - - <% end %> - - <%= f.text_field :email, :class => "text top", :placeholder => "Email" %> - <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %> - - <% if devise_mapping.rememberable? -%> -
- <% end -%> -
- <%= f.submit "Sign in", :class => "primary btn" %> -
<%= render :partial => "devise/shared/links" %>
- - <%- if devise_mapping.omniauthable? %> - <%- resource_class.omniauth_providers.each do |provider| %> -
- <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %>
+ <%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> +
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %>
+ <% end -%> <% end -%> - <% end -%> + <% end %> + +<% else %> + <%= render :partial => 'devise/sessions/new_ldap' %> <% end %>