Add new login design

This commit is contained in:
Martin Lensment 2014-09-25 14:19:53 +03:00
parent 1f2c12d7da
commit a0592833a9
17 changed files with 64 additions and 13 deletions

View file

@ -0,0 +1,14 @@
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
}
.form-signin {
max-width: 330px;
padding: 15px;
margin: 0 auto;
input {
margin-bottom: 10px;
}
}

View file

@ -1,6 +1,4 @@
class Admin::DomainsController < ApplicationController
load_and_authorize_resource
before_action :set_domain, only: [:show, :edit, :update, :destroy]
before_action :verify_deletion, only: [:destroy]

View file

@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
if current_user.admin?
if resource.admin?
(session[:user_return_to].nil?) ? admin_root_path : session[:user_return_to].to_s
else
(session[:user_return_to].nil?) ? client_root_path : session[:user_return_to].to_s

View file

@ -1,5 +1,3 @@
class ClientController < ApplicationController
def current_user
EppUser.last
end
end

View file

@ -2,6 +2,7 @@ module Shared::CommonDomain
extend ActiveSupport::Concern
included do
load_and_authorize_resource
before_action :set_domain, only: [:show, :edit, :update, :destroy]
before_action :verify_deletion, only: [:destroy]
end

View file

@ -1,7 +1,11 @@
class SessionsController < Devise::SessionsController
def create
@user = User.find_by(identity_code: '37810013855')
sign_in_and_redirect @user, :event => :authentication
if Rails.env.development?
@user = User.find_by(username: 'gitlab') if params[:gitlab]
@user = User.find_by(username: 'zone') if params[:zone]
sign_in_and_redirect @user, :event => :authentication
return
end
end
def login

View file

@ -7,6 +7,7 @@ class Ability
if user.admin?
can :manage, Domain
else
can :manage, Domain, registrar_id: user.registrar.id
can :read, DomainTransfer, transfer_to_id: user.registrar.id
can :approve_as_client, DomainTransfer, transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
end

View file

@ -3,6 +3,7 @@ class Registrar < ActiveRecord::Base
has_many :domains
has_many :ns_sets
has_many :epp_users
has_many :users
has_many :domain_transfers, foreign_key: 'transfer_to_id'
def to_s

View file

@ -7,4 +7,5 @@ class User < ActiveRecord::Base
# TODO Estonian id validation
belongs_to :role
belongs_to :registrar
end

View file

@ -1 +1,24 @@
= button_to 'logi sisse', 'sessions'
!!!
%html{:lang => "en"}
%head
%meta{:charset => "utf-8"}/
%meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}/
%meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}/
%meta{:content => "Full stack top-level domain (TLD) management.", :name => "description"}/
%meta{:content => "Gitlab LTD", :name => "author"}/
= csrf_meta_tags
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= stylesheet_link_tag 'login', media: 'all', 'data-turbolinks-track' => true
%link{:href => "../../favicon.ico", :rel => "icon"}/
%title Eesti Interneti SA - Log In
%body
.container
.form-signin
%h2.form-signin-heading.text-center Eesti Interneti SA
%hr
- if Rails.env.development?
= button_to 'ID card (gitlab)', 'sessions', class: 'btn btn-lg btn-primary btn-block', name: 'gitlab'
= button_to 'ID card (zone)', 'sessions', class: 'btn btn-lg btn-primary btn-block', name: 'zone'
-else
= button_to 'ID card', 'sessions', class: 'btn btn-lg btn-primary btn-block'
= button_to 'Mobile ID', 'sessions', class: 'btn btn-lg btn-primary btn-block'