Commit 848b5e99fc906d97682a11a4408b3ad0b54e5348

Authored by jdamick
1 parent 50dabb54

moved the ldap login to its own partial and cleaned up the forms a little bit

app/views/devise/sessions/_new_ldap.html.erb 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<%#= form_for(resource, :as => resource_name, :url => user_omniauth_callback_path(:ldap), :html => { :class => "login-box", :id => 'new_ldap_user' }) do |f| %>
  2 +<%= form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do %>
  3 + <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
  4 +
  5 + <%= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} %>
  6 + <%= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %>
  7 +
  8 + <br/>
  9 + <%= submit_tag "LDAP Sign in", :class => "primary btn" %>
  10 +
  11 + <%- if devise_mapping.omniauthable? %>
  12 + <%- (resource_class.omniauth_providers - [:ldap]).each do |provider| %>
  13 + <hr/>
  14 + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
  15 + <% end -%>
  16 + <% end -%>
  17 +
  18 + <hr/>
  19 + <a href="#" id="other_form_toggle" onclick="javascript:$('#new_user').toggle();">Other Sign in</a>
  20 + <!-- inline for right now just to illustrate -->
  21 + <script type="text/javascript">
  22 + $(function() {
  23 + $('#new_user').toggle();
  24 + });
  25 + </script>
  26 +<% end %>
  27 +
  28 +
  29 +<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
  30 + <%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
  31 + <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
  32 +
  33 + <% if devise_mapping.rememberable? -%>
  34 + <div class="clearfix inputs-list"> <label class="checkbox remember_me" for="user_remember_me"><%= f.check_box :remember_me %><span>Remember me</span></label></div>
  35 + <% end -%>
  36 + <br/>
  37 + <%= f.submit "Sign in", :class => "primary btn" %>
  38 + <div class="right"> <%= render :partial => "devise/shared/links" %></div>
  39 +
  40 +<% end %>
... ...
app/views/devise/sessions/new.html.erb
1   -<% if ldap_enable? -%>
2   - <%= form_for(resource, :as => resource_name, :url => user_omniauth_callback_path(:ldap), :html => { :class => "login-box", :id => 'new_ldap_user' }) do |f| %>
  1 +<% unless ldap_enable? -%>
  2 +
  3 + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
3 4 <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
4 5  
5   - <%= text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} %>
6   - <%= password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %>
  6 + <%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
  7 + <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
7 8  
8 9 <% if devise_mapping.rememberable? -%>
9 10 <div class="clearfix inputs-list"> <label class="checkbox remember_me" for="user_remember_me"><%= f.check_box :remember_me %><span>Remember me</span></label></div>
10 11 <% end -%>
11 12 <br/>
12   - <%= f.submit "LDAP Sign in", :class => "primary btn" %>
13   - <hr/>
14   - <a href="#" id="admin_form_toggle" onclick="javascript:$('#new_user').toggle();">Admin Sign in</a>
15   - <!-- inline right just to illustrate -->
16   - <script type="text/javascript">
17   - $(function() {
18   - $('#new_user').toggle();
19   - });
20   - </script>
21   - <% end %>
22   -<% end %>
23   -
24   -<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| %>
25   - <% unless ldap_enable? %>
26   - <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %>
27   - <% else %>
28   - <!-- <a href="#" id="ldap_form_toggle" onclick="javascript:$('#new_ldap_user').toggle();">LDAP Sign in</a> -->
29   - <% end %>
30   -
31   - <%= f.text_field :email, :class => "text top", :placeholder => "Email" %>
32   - <%= f.password_field :password, :class => "text bottom", :placeholder => "Password" %>
33   -
34   - <% if devise_mapping.rememberable? -%>
35   - <div class="clearfix inputs-list"> <label class="checkbox remember_me" for="user_remember_me"><%= f.check_box :remember_me %><span>Remember me</span></label></div>
36   - <% end -%>
37   - <br/>
38   - <%= f.submit "Sign in", :class => "primary btn" %>
39   - <div class="right"> <%= render :partial => "devise/shared/links" %></div>
  13 + <%= f.submit "Sign in", :class => "primary btn" %>
  14 + <div class="right"> <%= render :partial => "devise/shared/links" %></div>
40 15  
41   - <%- if devise_mapping.omniauthable? %>
42   - <%- resource_class.omniauth_providers.each do |provider| %>
43   - <hr/>
44   - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
  16 + <%- if devise_mapping.omniauthable? %>
  17 + <%- resource_class.omniauth_providers.each do |provider| %>
  18 + <hr/>
  19 + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
  20 + <% end -%>
45 21 <% end -%>
46   - <% end -%>
47 22  
  23 + <% end %>
  24 +
  25 +<% else %>
  26 + <%= render :partial => 'devise/sessions/new_ldap' %>
48 27 <% end %>
... ...