-
Notifications
You must be signed in to change notification settings - Fork 166
LG-233 Add account access details to account page #2141
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7ba4e1c
LG-233 Add account access details to account page
monfresh d03d05f
add geocoding
monfresh f05345e
Add separate login history and localize it
monfresh 272f3c1
Store GeoLite DB in S3 and pull it down on deploy
monfresh ee14dfd
Download geocoding DB via bin/setup
monfresh c8e45b6
Merge branch 'master' into mb-lg-233-account-access
jmhooper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| class LoginPresenter | ||
| include ActionView::Helpers::DateHelper | ||
|
|
||
| def initialize(user:) | ||
| @user = user | ||
| end | ||
|
|
||
| def current_sign_in_location_and_ip | ||
| I18n.t('account.index.sign_in_location_and_ip', location: current_location, ip: current_ip) | ||
| end | ||
|
|
||
| def last_sign_in_location_and_ip | ||
| I18n.t('account.index.sign_in_location_and_ip', location: last_location, ip: last_ip) | ||
| end | ||
|
|
||
| def current_timestamp | ||
| timestamp = user.current_sign_in_at || Time.zone.now | ||
| I18n.t( | ||
| 'account.index.sign_in_timestamp', | ||
| timestamp: time_ago_in_words( | ||
| timestamp, highest_measures: 2, two_words_connector: two_words_connector | ||
| ) | ||
| ) | ||
| end | ||
|
|
||
| def last_timestamp | ||
| timestamp = user.last_sign_in_at || Time.zone.now | ||
| I18n.t( | ||
| 'account.index.sign_in_timestamp', | ||
| timestamp: time_ago_in_words( | ||
| timestamp, highest_measures: 2, two_words_connector: two_words_connector | ||
| ) | ||
| ) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_reader :user | ||
|
|
||
| def current_location | ||
| IpGeocoder.new(current_ip).location | ||
| end | ||
|
|
||
| def last_location | ||
| IpGeocoder.new(last_ip).location | ||
| end | ||
|
|
||
| def current_ip | ||
| user.current_sign_in_ip | ||
| end | ||
|
|
||
| def last_ip | ||
| user.last_sign_in_ip | ||
| end | ||
|
|
||
| def two_words_connector | ||
| " #{I18n.t('datetime.dotiw.two_words_connector')} " | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| class IpGeocoder | ||
| def initialize(ip) | ||
| @ip = ip | ||
| end | ||
|
|
||
| def location | ||
| geocoded_location&.language = I18n.locale | ||
|
|
||
| return city_and_state if both_city_and_state_present? | ||
| return country if country.present? | ||
|
|
||
| I18n.t('account.index.unknown_location') | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_reader :ip | ||
|
|
||
| def city_and_state | ||
| "#{city}, #{state}" | ||
| end | ||
|
|
||
| def both_city_and_state_present? | ||
| city.present? && state.present? | ||
| end | ||
|
|
||
| def city | ||
| geocoded_location&.city | ||
| end | ||
|
|
||
| def state | ||
| geocoded_location&.state_code | ||
| end | ||
|
|
||
| def country | ||
| geocoded_location&.country | ||
| end | ||
|
|
||
| def geocoded_location | ||
| @geocoded_location ||= Geocoder.search(ip).first | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .p2.clearfix.border-top | ||
| .clearfix.mxn1 | ||
| .sm-col.sm-col-6.px1 | ||
| .bold = presenter.current_sign_in_location_and_ip | ||
| .sm-col.sm-col-6.px1.sm-right-align | ||
| = presenter.current_timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .p2.clearfix.border-top | ||
| .clearfix.mxn1 | ||
| .sm-col.sm-col-6.px1 | ||
| .bold = presenter.last_sign_in_location_and_ip | ||
| .sm-col.sm-col-6.px1.sm-right-align | ||
| = presenter.last_timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Geocoder.configure( | ||
| ip_lookup: :geoip2, | ||
| geoip2: { | ||
| file: Rails.root.join('geo_data', 'GeoLite2-City.mmdb'), | ||
| } | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| en: | ||
| datetime: | ||
| dotiw: | ||
| two_words_connector: and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| es: | ||
| datetime: | ||
| dotiw: | ||
| two_words_connector: y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| fr: | ||
| datetime: | ||
| dotiw: | ||
| two_words_connector: et |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to make this bucket exists in both the sandbox and prod account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was in the sandbox account's bucket. I just uploaded it to the prod account.