mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Basic login
This commit is contained in:
parent
ba93ac8162
commit
c997f2da5d
18 changed files with 428 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
|||
class Admin::DomainsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
|
||||
before_action :set_domain, only: [:show, :edit, :update, :destroy]
|
||||
before_action :verify_deletion, only: [:destroy]
|
||||
|
||||
|
|
|
@ -2,4 +2,12 @@ class ApplicationController < ActionController::Base
|
|||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
if current_user.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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
10
app/controllers/sessions_controller.rb
Normal file
10
app/controllers/sessions_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class SessionsController < Devise::SessionsController
|
||||
def create
|
||||
@user = User.find_by(identity_code: '37810013855')
|
||||
sign_in_and_redirect @user, :event => :authentication
|
||||
end
|
||||
|
||||
def login
|
||||
render 'layouts/login', layout: false
|
||||
end
|
||||
end
|
|
@ -4,7 +4,6 @@ class Ability
|
|||
def initialize(user)
|
||||
|
||||
# user ||= EppUser.last
|
||||
|
||||
can :read, DomainTransfer, transfer_to_id: user.registrar.id
|
||||
can :approve_as_client, DomainTransfer, transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
|
||||
# Define abilities for the passed in user here. For example:
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class User < ActiveRecord::Base
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :trackable, :timeoutable
|
||||
# TODO Foreign user will get email with activation link,email,temp-password.
|
||||
# After activisation, system should require to change temp password.
|
||||
# TODO Estonian id validation
|
||||
|
|
1
app/views/layouts/login.haml
Normal file
1
app/views/layouts/login.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= button_to 'logi sisse', 'sessions'
|
Loading…
Add table
Add a link
Reference in a new issue