Fixed #291 Added OAuth2 for Office365 (GRN-32) (#293)

* <Added omniauth for office365>

* <Fixed code style>

* Update puma.rb

* <Inserted link to documentation>
This commit is contained in:
John Ma
2018-10-16 12:58:06 -04:00
committed by Jesus Federico
parent 90b965d03f
commit ec250f3ed5
7 changed files with 38 additions and 3 deletions

View File

@ -60,7 +60,12 @@ class User < ApplicationRecord
# Provider attributes.
def auth_name(auth)
auth['info']['name']
case auth['provider']
when :microsoft_office365
auth['info']['display_name']
else
auth['info']['name']
end
end
def auth_username(auth)
@ -83,7 +88,7 @@ class User < ApplicationRecord
when :twitter
auth['info']['image'].gsub("http", "https").gsub("_normal", "")
else
auth['info']['image']
auth['info']['image'] unless auth['provider'] == :microsoft_office365
end
end
end

View File

@ -41,6 +41,12 @@
<% end %>
<% end %>
<% if configured_providers.include? :microsoft_office365 %>
<%= link_to omniauth_login_url(:microsoft_office365), class: "btn btn-pill btn-primary btn-block" do %>
<i class="fab fa-windows"></i>&ensp;<%= t("modal.login.with", provider: "Office365") %>
<% end %>
<% end %>
<div class="or-line my-6">
<div>
<span class="text-uppercase">

View File

@ -40,6 +40,12 @@
<% end %>
<% end %>
<% if configured_providers.include? :microsoft_office365 %>
<%= link_to omniauth_login_url(:microsoft_office365), class: "btn btn-pill btn-primary btn-block" do %>
<i class="fab fa-windows"></i>&ensp;<%= t("signup.with", provider: "Office365") %>
<% end %>
<% end %>
<div class="or-line my-3">
<div>
<span class="text-uppercase" style="background-color: #F5F7FB;">