forked from publiclab/plots2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduced login redundancy (publiclab#4605)
* reduced login redundancy * Revert "reduced login redundancy" This reverts commit 0ca2c7d. * changed new.html and header * moved partial content to file
- Loading branch information
Showing
3 changed files
with
52 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,66 @@ | ||
<div class="container"> | ||
<%= form_for :user_session, :as => :user_session, :url => "/user_sessions?return_to=" + request.fullpath, :html => {:class => "form col-md-6 offset-3"} do |f| %> | ||
|
||
<%= form_for :user_session, :as => :user_session, :url => { :action => "create" }, :html => {:class => "form col-md-6 offset-3"} do |f| %> | ||
|
||
<h2><%= raw t('user_sessions.new.log_in_or_sign_up', :url1 => "/signup") %></h2> | ||
<h2 id="toSignup"><%= raw t('user_sessions.new.log_in_or_sign_up', :url1 => "#") %></h2> | ||
<% if f.error_messages != "" %><div class="alert alert-danger"><%= f.error_messages %></div><% end %> | ||
<br style="clear:both;"/> | ||
<div class='col-lg-10 col-md-10 col-sm-10' style="display:flex; justify-content: center;"> | ||
<%= render :partial => "layouts/social_icons" %> | ||
</div> | ||
|
||
|
||
<br style="clear:both;"/> | ||
|
||
<div class="form-group"> | ||
|
||
<label for="username"><%= t('user_sessions.new.username') %></label> | ||
<%= f.text_field :username, { tabindex: 1, class: 'form-control', id: 'username-signup' } %> | ||
|
||
<div class='col-lg-11 col-md-11 col-sm-11' style="display:flex; justify-content: center;"> | ||
<%= render :partial => "layouts/social_icons" %> | ||
</div> | ||
<br /> | ||
|
||
<div class="form-group"> | ||
|
||
<label for="password"><%= t('user_sessions.new.password') %></label> | ||
<%= f.password_field :password, { tabindex: 2, class: 'form-control', id: 'password-signup', onpaste: 'return false;' } %> | ||
<br style="clear:both;"/> | ||
|
||
</div> | ||
<div id="toggle" class='col-lg-11 col-md-11 col-sm-11'> | ||
<div class="form-group"> | ||
<label for="username"><%= t('user_sessions.new.username') %></label> | ||
<%= f.text_field :username, { tabindex: 1, placeholder: "Username", class: 'form-control', id: 'username-signup', style: 'width: 85%' } %> | ||
<label for="password"><%= t('user_sessions.new.password') %></label> | ||
<%= f.password_field :password, { tabindex: 2,placeholder: "Password",class: 'form-control', id: 'password-signup', style: 'width: 85%', onpaste: 'return false;' } %> | ||
</div> | ||
|
||
<input type="hidden" name="return_to" value="<%= params[:return_to] %>" /> | ||
<input type="hidden" name="return_to" value="<%= params[:return_to] %>" /> | ||
<input type="hidden" name="hash_params" value="" /> | ||
<div class="checkbox"> | ||
<label> | ||
<%= f.check_box :remember_me %> <%= t('user_sessions.new.remember_me') %> | ||
</label> | ||
</div> | ||
|
||
<div class="checkbox"> | ||
<label> | ||
<%= f.check_box :remember_me %> <%= t('user_sessions.new.remember_me') %> | ||
</label> | ||
</div> | ||
<div class="input-group-inline"> | ||
|
||
<div class="input-group-inline"> | ||
<button class="btn btn-primary btn-lg" type="submit" tabindex="3"><%= t('user_sessions.new.log_in') %></button> | ||
|
||
<button class="btn btn-primary btn-lg" type="submit" tabindex="3"><%= t('user_sessions.new.log_in') %></button> | ||
</div> | ||
</br> | ||
|
||
<p style="color: #888;"><%= raw t('user_sessions.new.reset_by_clicking_here', :url1 => "/reset/") %></p> | ||
</div> | ||
</br> | ||
|
||
<p style="color: #888;"><%= raw t('user_sessions.new.reset_by_clicking_here', :url1 => "/reset/") %></p> | ||
<% end %> | ||
|
||
<% end %> | ||
<% if !current_user %> | ||
<script> | ||
$(document).ready(function() { | ||
$('a.requireLogin').click(function(e) { //For every link that should require login | ||
e.preventDefault(); //Prevent automatically redirecting to the link specified by href | ||
var mode = $(this).data('mode') || 'login'; | ||
setMode(mode); //Sets the mode of the modal to login if data-mode not specified | ||
$('#loginModal').modal('show');//Open the login modal to allow user to login | ||
$.getJSON($(this).attr('href')); | ||
/*send a request for the site the href specified, | ||
Because login modal uses request.fullpath as part of its | ||
redirect parameters, we can send a request to the link | ||
we want to redirect to so this variable gets updated to | ||
that link. Now when the user logs in, it should go to that link.*/ | ||
}); | ||
}); | ||
</script> | ||
|
||
<% end %> | ||
<script> | ||
$("a.loginToggle").click(function(){ //When a button that always toggles the login modal is clicked | ||
setMode("login"); //Sets the mode of the modal to login, to show only the login partial | ||
$('#loginModal').modal(); //Open the login modal to allow user to login | ||
}) | ||
</script> | ||
</div> |