Skip to content

Commit

Permalink
Easier two-factor auth workflow + marketing
Browse files Browse the repository at this point in the history
  • Loading branch information
parterburn committed Jan 16, 2024
1 parent 5d6ddc7 commit dff3c55
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
7 changes: 7 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ hr {
text-align:center;
}
}
.flex {
display: flex; width: 100%;column-gap: 10px;
@media screen and (max-width: 767px) {
display: block;
column-gap: 0px;
}
}
}

.s-inspiration {
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,12 @@ def review
{ name: sentiment, data: base_data.merge(data) }
end
end
elsif current_user.entries.any?
prev_year = current_user.entries.first.date.year.to_s
flash[:alert] = "No entries in #{@year} - sending you back to #{prev_year}"
redirect_to review_path(prev_year)
else
flash[:notice] = "No entries in #{@year} - nothing to review :("
flash[:alert] = "No entries to review :("
redirect_to entries_path
end
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/devise/registrations/_user_settings.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
%em{style: "color: #666;"}
%span<> Visit
= link_to "Account Security", security_path, class: "s-delete", style: "opacity: 100%;margin-left: 5px;"
to change your email, password, two-factor settings, or delete your account.
to change your email, password,
=link_to("two-factor authentication", user_otp_token_path, class: "s-delete", style: "opacity: 100%;") + ", or delete your account."
%br

.col-md-8.col-md-offset-2
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/security.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
%br

.col-md-8.col-md-offset-2
%strong= link_to (resource.otp_enabled? ? "✅ Change Two-Factor Authentication" : "⚠️ Setup Two-Factor Authentication"), "users/otp/token"
%strong= link_to (resource.otp_enabled? ? "✅ Change Two-Factor Authentication" : "⚠️ Setup Two-Factor Authentication"), user_otp_token_path
%br
%br

Expand Down
13 changes: 9 additions & 4 deletions app/views/shared/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%footer.footer
.container
%hr
.row
.col-sm-5
.flex
%div{style: "flex: none;"}
%p.muted.float-left
=link_to "CONTACT & FAQS", faqs_path, title: "Contact & FAQs"
&nbsp;&middot;&nbsp;
Expand All @@ -12,8 +12,13 @@
-if current_user && current_user.is_free?
&nbsp;&middot;&nbsp;
=link_to "SUBSCRIBE TO PRO", subscribe_path, title: "Subscribe Now"
.col-sm-2
.col-sm-5
%div.muted{style: "font-size: 13px; flex: 1 1 0%;text-align: center;margin-bottom: 10px;"}
- two_factor_marketing = !current_user.otp_enabled? && current_user.created_at < 1.day.ago && Date.today.between?(Date.parse("2024-01-15"), Date.parse("2024-02-15"))
- if two_factor_marketing
%span.label.label-default{style: "margin-right: 4px; position: relative;top:-2px;font-weight: normal; font-size: 10px; font-family: sans-serif;padding: 3px 5px;"} NEW
Protect your account by setting up
= link_to("two-factor authentication", user_otp_token_path, style: "color: #649cc7") + "."
%div{style: "flex: none;"}
%p.muted.float-right
&nbsp;&nbsp;
= link_to 'https://paularterburn.com/', title: "Made by Paul Arterburn" do
Expand Down

0 comments on commit dff3c55

Please sign in to comment.