[Fix #1096] Sign in with GitHub page

This commit is contained in:
Mathieu Magnin 2017-12-21 11:41:44 +01:00
parent 7c0fdbc9f8
commit 4990595430
6 changed files with 39 additions and 3 deletions

View file

@ -16,4 +16,8 @@
&.justify-between { &.justify-between {
justify-content: space-between; justify-content: space-between;
} }
&.justify-center {
justify-content: center;
}
} }

View file

@ -0,0 +1,11 @@
@import "constants";
.super-admin {
margin-top: 40px;
text-align: center;
h2 {
font-size: 24px;
margin-bottom: 4 * $default-spacer;
}
}

View file

@ -0,0 +1,11 @@
class Administrations::SessionsController < ApplicationController
layout "new_application"
def new
end
def destroy
sign_out :administration if administration_signed_in?
redirect_to root_path
end
end

View file

@ -13,4 +13,4 @@
%br %br
.text-center .text-center
= link_to 'Deconnexion', '/administrations/sign_out', method: :delete = link_to 'Deconnexion', administrations_sign_out_path, method: :delete

View file

@ -0,0 +1,6 @@
.super-admin.flex.justify-center
%div
%h2 Espace Admin
= link_to administration_github_omniauth_authorize_path, class: "button large" do
%span.icon.lock
Connexion avec GitHub

View file

@ -2,8 +2,10 @@ Rails.application.routes.draw do
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/} get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/}
devise_for :administrations, devise_for :administrations,
skip: [:password, :registrations], skip: [:password, :registrations, :sessions],
controllers: { omniauth_callbacks: 'administrations/omniauth_callbacks' } controllers: {
omniauth_callbacks: 'administrations/omniauth_callbacks'
}
devise_for :administrateurs, controllers: { devise_for :administrateurs, controllers: {
sessions: 'administrateurs/sessions' sessions: 'administrateurs/sessions'
@ -44,6 +46,8 @@ Rails.application.routes.draw do
get 'admin' => 'admin#index' get 'admin' => 'admin#index'
get 'backoffice' => 'backoffice#index' get 'backoffice' => 'backoffice#index'
get 'administrations/sign_in' => 'administrations/sessions#new'
delete 'administrations/sign_out' => 'administrations/sessions#destroy'
authenticate :administration do authenticate :administration do
resources :administrations, only: [:index, :create] resources :administrations, only: [:index, :create]
namespace :administrations do namespace :administrations do