mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
SECURITY: signup without verified email using Google auth
This commit is contained in:
@ -85,16 +85,31 @@ describe Auth::GoogleOAuth2Authenticator do
|
||||
context 'after_create_account' do
|
||||
it 'confirms email' do
|
||||
authenticator = Auth::GoogleOAuth2Authenticator.new
|
||||
user = Fabricate(:user)
|
||||
user = Fabricate(:user, email: 'realgoogleuser@gmail.com')
|
||||
session = {
|
||||
email_valid: "true",
|
||||
extra_data: {
|
||||
google_user_id: 1
|
||||
google_user_id: 1,
|
||||
email: 'realgoogleuser@gmail.com'
|
||||
}
|
||||
}
|
||||
authenticator.after_create_account(user, session)
|
||||
expect(user.email_confirmed?).to eq(true)
|
||||
end
|
||||
|
||||
it "doesn't confirm email if it was changed" do
|
||||
authenticator = Auth::GoogleOAuth2Authenticator.new
|
||||
user = Fabricate(:user, email: 'changed@gmail.com')
|
||||
session = {
|
||||
email_valid: "true",
|
||||
extra_data: {
|
||||
google_user_id: 1,
|
||||
email: 'realgoogleuser@gmail.com'
|
||||
}
|
||||
}
|
||||
authenticator.after_create_account(user, session)
|
||||
expect(user.email_confirmed?).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user