* Move .skip_confirmation! call to .find_or_create_user! method
* Add regression tests to avoid email confirmation delivery
* Keep the original place where we had user.skip_confirmation! too
* Update logic to require email confirmation from omniauth
* test confirmation is required with SMTP
* Keep :notice instead of :global_notice
* Forem Account bypass email confirmation reorg
* inline comment reorder + clarification
* Apply suggestions from code review
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* Don't update social information for suspended/banished accounts
* Prevent suspended users/accounts from updating their profile information
* Add tests and fix some logic
* Avoid email reassignment when connecting oauth provider
* Use less intrusive approach (we still want to preserve <provider>_username assignment)
* Add spec to avoid regressions
* Enable Forem (Passport) Auth
* Remove feature flag DUS
* Add prompt for Forem Passport in admin
* Add spec & fix broken one
* Link to docs instead of passport site
* Guarding against spam from OAuth Sources
Prior to this commit, when an administrator had indicated blocked email
domains, those blocks were not applied to identities created via the
OAuth sources (e.g., Twitter, Facebook, etc). With this change, we're
hooking into the similar logic flow as suspended email accounts.
Related to #15403, #15397, and forem/rfcs#281
* Adding class documentation to exception
* Update app/services/authentication/authenticator.rb
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Initial forem omniauth strategy setup work
* Finish basic raw proof of concept
* Some playing around
* use OAuth payloads + PASSPORT_OAUTH_URL for local dev
* Use FeatureFlag for Forem Passport Auth
* Working on tests
* Fix tests 🤞🏼 & some cleanup
* Use correct namespace within lib directory (match class namespace)
* Test to ensure Forem Passport auth is restricted by FeatureFlag
* Add broadcast + work on tests
* Update spec/lib/data_update_scripts/insert_forem_connect_broadcast_message_spec.rb
Co-authored-by: Michael Kohl <citizen428@forem.com>
* Hash format
* Schema cleanup + inline comments
* Use temprorary Heroku domain
* More cleanup
* Missed one
* Back to passport.forem.com
* Require correct path in lib
* Apply suggestions from code review
Co-authored-by: Michael Kohl <citizen428@forem.com>
* Use with_indifferent_access for symbol hash access in Forem strategy
Co-authored-by: benhalpern <bendhalpern@gmail.com>
Co-authored-by: Michael Kohl <citizen428@forem.com>
* schema file undelete description
* feat: v1 of the script
* Flesh out remaining enums under their categories
* complete UsersSettings data update script
* complete DUS for relevant attributes in users and profiles tables
* complete DUS for users_notification_settings
* alphabetize user_settings sql file
* safeguard against null values for "null: false" settings
* Set up actual UsersSettings DUS and specs files
* fix broken DUS script
* complete specs for UsersSetting DUS
* Address QA of specs
* complete specs for users_notification_settings DUS
* fix the typos (thanks Julianna!)
* begin implementation
* still building
* add missing attribute "email_membership_newsletter"
* complete sync code (except race condition for user profile)
* complete implementation, remains tests
* Address PR review and fix Travis fails
* remove superfluous Profile.new
* fix travis fails
* feat: update the users_notification_setting attributes from the user model
* feat: use the config fonts enums to display the fonts
* feat: loop through the keys
* fix profile = nil blowing up; add specs for notification_setting model
* remove unneeded spec
* remove feed validation until after sync code removed; fixes feed_import spec failures
* remove spec associated with feed_url validation in user_setting model
* fix failing spec 😅
* add TODO
* feat: set the user settings in the user controller and use it in the customization form
* feat: move some update logic to the users settings controller thats being used from customization
* feat: show the updated values form the users_settingd and not the user instance
* Generalize redirect back to current tab
* still trying to reflect changed theme upon refresh
* customizations take effect on refresh
* remove 'with_feed' scope from user model
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* start with takeover for fields previously in profiles table
* Takeover code for `publishing_from_rss` section in Settings (#13914)
* implement takeover code part 1
* implement takeover code
* fix feed fetch
* need rhymes help
* complete implementation; specs pending
* fix STUPID omission that caused so many headaches 😫
* implement profile fields pointing to users_settings 🎉
* run migrations
* implement inbox type & guidelines takeover code; specs pending (#13911)
* Point changes in notification settings to `users_notification_settings` table (#13910)
* implement takeover code; remains specs
* address PR feedback; remove related sync code
* address PR review feedback
* need help with routing and specs
* address pr review
* addressing pr review
* Treat implementation edge cases and omissions 😅
* fix uncommented comment
* fixing implementation cases
* address more PR review feedback
* fixing notifications use-cases
* refactor settings controller
* more pr review changes
* solving bugs
* fix broken onboarding
* handle eperience_level calls
* more fixes
* remove unneeded mappings
* add To-dos for quety updates
* remove done TODO
* purge done TODOs
* update notification_settings-related queries
* start fixing specs
* fixing specs
* fix notification and lrg_forem specs
* fixing broken specs
* still fixing
* fix line dif and remove reloads from user.rb
* run specs
* silence bullet and other fixes
* remove setting migration scripts and specs, fix more settings for specs
* handle missing user for article builder and fix notification specs
* fix some final controller specs and re-add incorrectly removed specs
* remove deprecated data update scripts and related workers, put travis back
* refactor admin tags mods controller, write/move specs for users notifications settings controller
* schema cleanup and other small refactors for consistency
* set field we can invalidate in spec via active record instead of at the db level
* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter
* use bnefore_create to setup settings, please dont blow up the test suite
* mailchimp bot fix
* remove decorator in favor of single model method
Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Remove <provider>_created_at columns from User
* Update code
* Clean up
* Fix authenticator specs
* Restore old behavior
* Update provider account age logic, again
* This change abstracts the DatadogStatsClient into a ForemStatsClient.
The purpose of this abstraction is to set the foundation for a subsequent PR that will allow one to use New Relic for recording Forem stats, instead of Datadog, if there is a New Relic configuration found.
This specific change creates an abstraction layer that can be built upon, without changing any actual default behavior. All specs still pass.
* Use delegate instead of explicit methods.
* Delegate instead of explicit methods.
* Fix the error.
* Refactor according to the suggestions in the comments.
* Ooops. Stats work better when all of the code is committed.
* Removing the alias of count to increment since that was done in error.
* Add gem omniauth-apple
* Integrate omniauth-apple
* Integrate callback
* Add fields
* Add tests, fix bugs and make it all work
* Show only enabled providers for the current user
* Add default profile image for Apple
* Remove localhost patch
* Bring over the changed Apple username if the user changes it
* More specs fixed
* Incorporate feedback from PR
* Fix specs
* Simplify code and fix spec
* Fix Broadcast generators to take into account the new provider
* Fix spec
* Generate a truly unique apple_username
* Fix user specs
* Add omniauth-apple-0.0.2 to vendor cache
* Fix merge conflict and spec
* Update VCR fastly sloan cassette
* Revert "Generate a truly unique apple_username"
This reverts commit 2462875575b0bbd6b3c1d56b25afcd3189671608.
* Fix user specs
* Fix specs
* Fix specs
* Hide Connect Apple button behind a feature flag
* Revert "Hide Connect Apple button behind a feature flag"
This reverts commit 105bde0373389a4eb9b6e948f60734c7e0e99cba.
* Fix line lengths
* Fix spec
* ES tag
* CSRF bypass for Apple callback
* custom user_nickname in Apple provider with small tweaks + omniauth-apple bump
* Fixes username specs
* Makes Apple users default image Users::ProfileImageGenerator
* Fallback to mascot_image_url in test environment to avoid breaking Travis
* Fixes Apple CSRF error + makes default nickname more readable
* Trigger Travis
* Better devise config
* Apple SiteConfig entires in /admin/config
* Fixing specs
* Adds beta_access? to Authentication::Providers::Provider
* Fixes specs
* Codeclimate double quote fix in Gemfile
* Fixes /admin/config allowed params & adds feature flag for provider beta_access?
* Remove Enfile & adds temporary docs
* Adds custom apple auth provider settings
* Fix authenticator spec
* Fix configs spec (use last instead of first to avoid apple special case)
* Remove dangling fields from /admin/config
* updates feature flag
* More test fixes
* Hide config behind feature flag too
* omniauth-apple bump
* Takes care of edge case fallback
* Reverse apple_username update
* Adds auth_time to info hash in apple omniauth mock
* Switch to next instead of nesting for feature flag
* Fixes CVE-2015-9284
* Fixes specs after auth providers initiatior refactor from GET to POST
* Spec fixes
* More spec fixes
* Fix Rails codebase reference link
Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: rhymes <rhymes@hey.com>
* Use Devise registry to list available providers
* Cleanups following Devise+Omniauth docs
* More cleanups
* Use helpers
* More cleanups
* Oops, forgot to remove these specs
* Wrap user/identity coupled logic in a transaction
Creating a user and then setting an identiy should occur as an all-or-nothing step.
Wrapping this in an ActiveRecord::Transaction ensures that we don't update an identity
unless we succesfully create/update the user first in the same database transaction.
* Allow errors from authenticator service to bubble up
* Address some issues with logic in ActiveRecord::Base.transaction
* Pull out calls to DataDog from transaction.
* Add additional DataDog call in case something goes wrong in the transaction.
* Rename some methods, add some specs.
* Re-raise errors after notifying DataDog
* Add error message to DataDog tags in Authenticator
* Add Authentication providers
* Making strides on refactoring
* New usr from Twitter
* Existing Twitter user
* Existing user Github
* Test skip_confirmation!
* Refactor a bit and add simplecov groups
* Test user already logged in
* Rename to Authentication::Authenticator
* Refactor to a common class
* Add existing user test for twitter login
* Refactor global handler
* Fix spec and comment Twitter provider
* Update comments and strategy TODO
* Move providers loading code to Authentication::Providers
* add SubclassResponsibility error
* Use delegation