Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

74 auth via email link gem passwordless #75

Merged
merged 28 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bc15fcc
add passwordless
yshmarov Nov 8, 2022
d2e34ba
add gem letter-opener
yshmarov Nov 8, 2022
973942c
add passwordless views
yshmarov Nov 8, 2022
333b627
make sign in work
yshmarov Nov 8, 2022
0775293
users#show, basic views work
yshmarov Nov 8, 2022
bb9897a
Update new.html.erb
yshmarov Nov 8, 2022
6830e43
no more need to load insta user in session
yshmarov Nov 8, 2022
c9c0bac
insta user belongs to user
yshmarov Nov 8, 2022
a56e780
add passwordless initializer
yshmarov Nov 8, 2022
babb292
prepare for sending emails in production
yshmarov Nov 8, 2022
2ea5c44
require user for users controller, i18n
yshmarov Nov 8, 2022
37d2719
Update new.html.erb
yshmarov Nov 8, 2022
fcc20b6
associate insta user with user
yshmarov Nov 8, 2022
a6e15ff
display insta users of a user
yshmarov Nov 8, 2022
a88413a
no need for user partial in insta users index
yshmarov Nov 8, 2022
479b9d7
validation for import action
yshmarov Nov 8, 2022
074b6c0
move import action from ig_posts to ig_user
yshmarov Nov 8, 2022
0b4bcbb
Update show.html.erb
yshmarov Nov 8, 2022
edb31c7
Update show.html.erb
yshmarov Nov 8, 2022
0e9acd5
fix import
yshmarov Nov 9, 2022
52e1237
depreciate insta_user#show in favour of insta posts#index
yshmarov Nov 9, 2022
e9f56ef
Update new.html.erb
yshmarov Nov 9, 2022
3dafeba
after connect insta account redirect to user path
yshmarov Nov 9, 2022
32e2b91
Update users_controller.rb
yshmarov Nov 9, 2022
5e62487
annotate routes
yshmarov Nov 9, 2022
02573bb
update tests
yshmarov Nov 9, 2022
18c48da
update AWS SES creds for prod
yshmarov Nov 9, 2022
2fec4b0
Update user.rb
yshmarov Nov 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
insta user belongs to user
  • Loading branch information
yshmarov committed Nov 8, 2022
commit c9c0baca54d4e1c346c5d4eafdc1f3234b6ff2ea
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class UsersController < ApplicationController
def show
@user = current_user
@insta_users = @user.insta_users
end
end
1 change: 1 addition & 0 deletions app/models/insta_user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class InstaUser < ApplicationRecord
belongs_to :insta_user
has_many :insta_posts, dependent: :destroy
has_many :insta_access_tokens, dependent: :destroy
validates :username, presence: true, uniqueness: true
Expand Down
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class User < ApplicationRecord
has_many :insta_users, dependent: :destroy

validates :email, presence: true, uniqueness: { case_sensitive: false }

passwordless_with :email
Expand Down
8 changes: 8 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
<i class="fa-brands fa-instagram"></i>
<span>Connect an Instagram account</span>
<% end %>

<% if @insta_users.any? %>
Connected Instagram accounts:

<% @insta_users.each do |insta_user| %>
<%= render partial: 'insta_users/insta_user', locals: { insta_user: } %>
<% end %>
<% end %>
5 changes: 5 additions & 0 deletions db/migrate/20221108132825_add_user_id_to_insta_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserIdToInstaUsers < ActiveRecord::Migration[7.0]
def change
add_reference :insta_users, :user, foreign_key: true
end
end
5 changes: 4 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.