Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Correct form validation #5087

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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