In the previous commit, we prevented existing users from connecting their social accounts without logging in first for security reasons. This PR adds a new tab to the "My Account" page that allows existing users to connect and disconnect their social accounts. If the email of the current account does not match the social account, we do not allow the operation. We also do not allow disconnecting the last login method. However, we can allow disconnecting the last omniauth provider if the user has a password. The `has_password?` method is not yet public in Rodauth, so I created a PR for it.
32 lines
669 B
Ruby
32 lines
669 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "spec_helper"
|
|
|
|
RSpec.describe Clover, "account" do
|
|
it "can not access without login" do
|
|
visit "/account"
|
|
|
|
expect(page.title).to eq("Ubicloud - Login")
|
|
end
|
|
|
|
describe "authenticated" do
|
|
before do
|
|
create_account
|
|
login
|
|
end
|
|
|
|
it "show password change page" do
|
|
visit "/account/change-password"
|
|
|
|
expect(page.title).to eq("Ubicloud - Change Password")
|
|
expect(page).to have_content "Change Password"
|
|
end
|
|
|
|
it "show 2FA manage page" do
|
|
visit "/account/multifactor-manage"
|
|
|
|
expect(page.title).to eq("Ubicloud - Multifactor Authentication")
|
|
end
|
|
end
|
|
end
|