Use standard login form

This commit is contained in:
Artur Beljajev 2018-08-09 13:43:11 +03:00
parent 080defa228
commit 1d95c1ccbc
6 changed files with 45 additions and 38 deletions

View file

@ -1,24 +1,29 @@
<div class="row">
<div class="form-signin col-md-6 center-block text-center">
<h2 class="form-signin-heading text-center">
<%= t(:log_in) %>
</h2>
<hr/>
<%= form_for @depp_user, url: registrar_user_session_path, html: { class: 'form-signin' } do |f| %>
<%= render 'registrar/shared/errors', object: f.object %>
<% error_class = f.object.errors.any? ? 'has-error' : '' %>
<div class="<%= error_class %>">
<%= f.text_field :tag, class: 'form-control', placeholder: t(:username), required: true %>
<%= f.password_field :password, class: 'form-control', autocomplete: 'off', placeholder: t(:password), required: true %>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">
<%= t '.login_btn' %>
</button>
<h1 class="form-signin-heading text-center"><%= t(:log_in) %></h1>
<hr>
<%= form_for resource, as: resource_name, url: session_path(resource_name) do |f| %>
<%= f.text_field :username, placeholder: ApiUser.human_attribute_name(:username),
autofocus: true,
required: true,
class: 'form-control' %>
<%= f.password_field :password,
autocomplete: 'off',
placeholder: ApiUser.human_attribute_name(:password),
required: true,
class: 'form-control' %>
<%= f.submit t('.submit_btn'), class: 'btn btn-lg btn-primary btn-block' %>
<% end %>
<hr/>
<hr>
<%= link_to '/registrar/login/mid', id: 'login-with-mobile-id-btn' do %>
<%= image_tag 'mid.gif' %>
<% end %>
<%= link_to '/registrar/id', method: :post do %>
<%= image_tag 'id_card.gif' %>
<% end %>

View file

@ -1,5 +0,0 @@
- if object.errors.any?
%p.text-danger
- object.errors.each do |attr, err|
= err
%br