Commit 0aeba9ec by Trịnh Hoàng Phúc

Facebook authenticate

parent b5ac3f15
Pipeline #624 failed with stages
in 0 seconds
...@@ -16,10 +16,10 @@ class User < ApplicationRecord ...@@ -16,10 +16,10 @@ class User < ApplicationRecord
user.email = auth.info.email user.email = auth.info.email
user.password = Devise.friendly_token[0, 20] user.password = Devise.friendly_token[0, 20]
user.full_name = auth.info.name # assuming the user model has a name user.full_name = auth.info.name # assuming the user model has a name
user.image = auth.info.image # assuming the user model has an image # user.image = auth.info.image # assuming the user model has an image
# If you are using confirmable and the provider(s) you use validate emails, # If you are using confirmable and the provider(s) you use validate emails,
# uncomment the line below to skip the confirmation emails. # uncomment the line below to skip the confirmation emails.
# user.skip_confirmation! user.skip_confirmation!
end end
end end
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<p class="actions"> <p class="actions">
<%= f.submit "Log in", class: "button" %> <%= f.submit "Log in", class: "button" %>
<%= link_to "Sign in with Facebook", user_facebook_omniauth_authorize_path, class: "button" %>
</p> </p>
<% end %> <% end %>
<p> <p>
......
...@@ -6,20 +6,20 @@ ...@@ -6,20 +6,20 @@
<%= link_to "Sign up", new_registration_path(resource_name) %><br /> <%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end %> <% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <!-- <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end %> <% end %> -->
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> <!-- <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_user_confirmation_path(resource_name) %><br /> <%= link_to "Didn't receive confirmation instructions?", new_user_confirmation_path(resource_name) %><br />
<% end %> <% end %> -->
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> <!-- <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br /> <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end %> <% end %> -->
<%- if devise_mapping.omniauthable? %> <!-- <%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %> <%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br /> <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<% end %> <% end %>
<% end %> <% end %> -->
...@@ -27,7 +27,14 @@ ...@@ -27,7 +27,14 @@
<div id="content" class="container content-area" role="main"> <div id="content" class="container content-area" role="main">
<div class="job-overview-content row"> <div class="job-overview-content row">
<div class="job_listing-description job-overview col-md-9 col-sm-12"> <div class="job_listing-description job-overview col-md-9 col-sm-12">
<h4>Benefit</h4>
<%= raw(@job.benefit) %>
<h4>Job requirements</h4>
<%= raw(@job.job_requirements) %>
<h4>Job description</h4>
<%= raw(@job.job_description) %> <%= raw(@job.job_description) %>
<h4>Other information</h4>
<%= raw(@job.other_information) %>
</div> </div>
<div class="job-meta col-md-3 col-sm-6 col-xs-12"> <div class="job-meta col-md-3 col-sm-6 col-xs-12">
<aside class="widget widget--job_listing"> <aside class="widget widget--job_listing">
...@@ -54,7 +61,7 @@ ...@@ -54,7 +61,7 @@
<ul> <ul>
<li>Name: <%= @job.company.title %></li> <li>Name: <%= @job.company.title %></li>
<li>Address: <%= @job.company.address %></li> <li>Address: <%= @job.company.address %></li>
<li>Description: <%= @job.company.description %></li> <li>Description: <%= raw(@job.company.description) %></li>
</ul> </ul>
</aside> </aside>
<aside class="widget widget--job_listing"> <aside class="widget widget--job_listing">
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<button type="submit" id="searchsubmit" class="searchform__submit searchform--header__submit"><span class="screen-reader-text">Search</button> <button type="submit" id="searchsubmit" class="searchform__submit searchform--header__submit"><span class="screen-reader-text">Search</button>
</form> </form>
<div class="nav-menu nav-menu--primary"> <div class="nav-menu nav-menu--primary">
<ul id="menu-main-menu" class="nav-menu nav-menu--primary">%> <ul id="menu-main-menu" class="nav-menu nav-menu--primary">
<% if !current_admin %> <% if !current_admin %>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-99991208"> <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-99991208">
<a href="/jobs">Find A Job</a> <a href="/jobs">Find A Job</a>
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
</li> </li>
<% end %> <% end %>
<% end %> <% end %>
<%= link_to "Sign in with Facebook", user_facebook_omniauth_authorize_path %>
</ul> </ul>
</div> </div>
</nav> </nav>
......
...@@ -3,7 +3,5 @@ class AddColumnsToUsers < ActiveRecord::Migration[6.0] ...@@ -3,7 +3,5 @@ class AddColumnsToUsers < ActiveRecord::Migration[6.0]
add_column :users, :full_name, :string add_column :users, :full_name, :string
add_column :users, :image, :string add_column :users, :image, :string
add_column :users, :cv, :string add_column :users, :cv, :string
add_column :users, :provider, :string
add_column :users, :uid, :string
end end
end end
class AddColumnsProviderAndUidToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :provider, :string
add_column :users, :uid, :string
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_05_11_055632) do ActiveRecord::Schema.define(version: 2020_05_15_033747) do
create_table "admins", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| create_table "admins", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
t.string "email", default: "", null: false t.string "email", default: "", null: false
...@@ -110,7 +110,6 @@ ActiveRecord::Schema.define(version: 2020_05_11_055632) do ...@@ -110,7 +110,6 @@ ActiveRecord::Schema.define(version: 2020_05_11_055632) do
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.string "full_name" t.string "full_name"
t.string "image"
t.string "cv" t.string "cv"
t.string "provider" t.string "provider"
t.string "uid" t.string "uid"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment