في بعض الأحيان، يواجه المستخدم مشكلة تتمثل في طُلب منه إعداد حساب Discourse جديد في كل مرة يحاول فيها تسجيل الدخول. يحدث هذا عادةً إما مع الحسابات القديمة التي عاد مؤخرًا لتسجيل الدخول إلى Discourse، أو مع المستخدمين الذين سجلوا باستخدام اسم المستخدم وكلمة المرور وحاولوا الآن تسجيل الدخول عبر OAuth. في الماضي، لحل هذه المشكلة، كان لا بد من ربط بيانات اعتماد Auth0 OAuth2 الخاصة بهم بمعرف المستخدم في Discourse بتشغيل الأمر التالي من وحدة تحكم rails داخل مثيل discourse:
يبدو أن المشكلة هي أن هذا الإجراء لم يعد يُحفظ؛ بل إنه يُرجع الآن =>True بينما كان يُرجع سابقًا Ok. أنا الآن في مطالبة pry، وهو أمر لم أكن أعتقد أنه يحدث في الماضي. وعندما أغادر Pry، يتم إخراجي أيضًا من وحدة تحكم Rails.
Sorry for the delay, I had to upgrade discourse before I tried again. I gave the change a shot but didn’t experience success. Below is the example of what I have since tried that return true.
Sorry about that @Falco, we too have had a hard time when having Community members go on vacation and not being able to keep everyone in the loop. I hope you had a great vacation and I apologize.
I will give your suggestion a go tomorrow and share the results. Thank you again for your help
Hey there @Falco, following up on this front. When I try to run the above suggested command I receive the below:
root@ip-172-31-20-121-app:/var/www/discourse# rails c
NOTE: Inheriting Faraday::Error::ClientError is deprecated; use Faraday::ClientError instead. It will be removed in or after version 1.0
Faraday::Error::ClientError.inherited called from /var/www/discourse/plugins/discourse-github/gems/2.6.5/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:14.
[1] pry(main)> UserAssociatedAccount.create!(provider_name: 'oauth2_basic', provider_uid: 'google-apps|nico@auth0.com', user_id: 1722)
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "associated_accounts_provider_uid"
DETAIL: Key (provider_name, provider_uid)=(oauth2_basic, google-apps|nico@auth0.com) already exists.
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.1.3/lib/patches/db/pg.rb:69:in `async_exec_params'
Caused by PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "associated_accounts_provider_uid"
DETAIL: Key (provider_name, provider_uid)=(oauth2_basic, google-apps|nico@auth0.com) already exists.
from /var/www/discours