Skip to content

Commit

Permalink
Added form Validation (publiclab#5087)
Browse files Browse the repository at this point in the history
  • Loading branch information
ananyaarun authored and icarito committed Apr 9, 2019
1 parent 862ea72 commit 0074183
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions app/views/user_sessions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</center>

<% if f.error_messages != "" %><div class="alert alert-danger"><%= f.error_messages %></div><% end %>

<br style="clear:both;"/>

<div class='col-lg-12 col-md-12 col-sm-12' style="display:flex; justify-content: center;">
Expand All @@ -19,31 +20,36 @@
<br style="clear:both;"/>

<div id="toggle" style="padding-left: 30px; padding-right: 30px;">
<div class="form-group">

<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-login' } %>
<%= f.text_field :username, { tabindex: 1, placeholder: "Username", class: 'form-control', id: 'username-login', required: true } %>
<label for="password"><%= t('user_sessions.new.password') %></label>
<%= f.password_field :password, { tabindex: 2,placeholder: "Password",class: 'form-control', id: 'password-signup', onpaste: 'return false;' } %>
</div>
<%= f.password_field :password, { tabindex: 2,placeholder: "Password",class: 'form-control', id: 'password-signup', onpaste: 'return false;' , required: true } %>

</div>

<input type="hidden" name="hash_params" value="" />

<div class="input-group-inline">

<button class="btn btn-primary btn-lg" type="submit" tabindex="3"><%= t('user_sessions.new.log_in') %></button>
<label class="checkbox-inline" style="margin-left:12px;">
<%= f.check_box :remember_me %> <%= t('user_sessions.new.remember_me') %>
<%= f.check_box :remember_me %> <%= t('user_sessions.new.remember_me') %>
</label>

</div>

<br />

<p style="color: #888;"><%= raw t('user_sessions.new.reset_by_clicking_here', :url1 => "/reset/") %></p>
<br />
<p style="color: #888;"><%= raw t('user_sessions.new.reset_by_clicking_here', :url1 => "/reset/") %></p>
</div>

<% end %>
<% if !current_user %>
<script>
<script>
$(document).ready(function() {
$('a.requireLogin').click(function(e) { //For every link that should require login
// intercept the function of the original link, don't go there (yet):
Expand All @@ -61,9 +67,9 @@
// thus redirecting there once login or signup is completed:
$('.login-modal-redirect').val(url);
}
</script>

</script>
<% end %>

<script>
$("a.loginToggle").click(function() {
// When a button that always toggles the login modal is clicked
Expand Down

0 comments on commit 0074183

Please sign in to comment.