-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
user email validation #23346
Merged
Merged
user email validation #23346
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8648182
user email validation
rashmivkulkarni 8301521
removed unwanted file from the PR
rashmivkulkarni 38a0c4b
removed the unwanted config changes
rashmivkulkarni 4cbac7e
Merge branch 'master' of github.com:elastic/kibana into email
rashmivkulkarni f8bfef7
added another data-test-subj for changePassword and incorporated the …
rashmivkulkarni f06722b
incorporated changes
rashmivkulkarni 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 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 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 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 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 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 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 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,72 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from 'expect.js'; | ||
import { indexBy } from 'lodash'; | ||
export default function ({ getService, getPageObjects }) { | ||
|
||
const PageObjects = getPageObjects(['security', 'settings', 'common', 'accountSetting']); | ||
const config = getService('config'); | ||
const log = getService('log'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
describe('useremail', function () { | ||
before(async () => { | ||
await esArchiver.load('discover'); | ||
await PageObjects.settings.navigateTo(); | ||
await PageObjects.security.clickElasticsearchUsers(); | ||
}); | ||
|
||
it('should show the default elastic and kibana users', async function () { | ||
const users = indexBy(await PageObjects.security.getElasticsearchUsers(), 'username'); | ||
log.info('actualUsers = %j', users); | ||
log.info('config = %j', config.get('servers.elasticsearch.hostname')); | ||
if (config.get('servers.elasticsearch.hostname') === 'localhost') { | ||
expect(users.elastic.roles).to.eql(['superuser']); | ||
expect(users.elastic.reserved).to.be(true); | ||
expect(users.kibana.roles).to.eql(['kibana_system']); | ||
expect(users.kibana.reserved).to.be(true); | ||
} else { | ||
expect(users.anonymous.roles).to.eql(['anonymous']); | ||
expect(users.anonymous.reserved).to.be(true); | ||
} | ||
}); | ||
|
||
it('should add new user', async function () { | ||
await PageObjects.security.addUser({ username: 'newuser', password: 'changeme', | ||
confirmPassword: 'changeme', fullname: 'newuserFirst newuserLast', email: '[email protected]', | ||
save: true, roles: ['kibana_user', 'superuser'] }); | ||
const users = indexBy(await PageObjects.security.getElasticsearchUsers(), 'username'); | ||
log.debug('actualUsers = %j', users); | ||
expect(users.newuser.roles).to.eql(['kibana_user', 'superuser']); | ||
expect(users.newuser.fullname).to.eql('newuserFirst newuserLast'); | ||
expect(users.newuser.email).to.eql('[email protected]'); | ||
expect(users.newuser.reserved).to.be(false); | ||
await PageObjects.security.logout(); | ||
}); | ||
|
||
it('login as new user and verify email', async function () { | ||
await PageObjects.security.login('newuser', 'changeme'); | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
}); | ||
|
||
it('click changepassword link, change the password and re-login', async function () { | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
await PageObjects.accountSetting.changePassword('changeme', 'mechange'); | ||
await PageObjects.security.logout(); | ||
}); | ||
|
||
|
||
it('login as new user with changed password', async function () { | ||
await PageObjects.security.login('newuser', 'mechange'); | ||
await PageObjects.accountSetting.verifyAccountSettings('[email protected]', 'newuser'); | ||
}); | ||
|
||
after(async function () { | ||
await PageObjects.security.logout(); | ||
}); | ||
}); | ||
} |
This file contains 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
34 changes: 34 additions & 0 deletions
34
x-pack/test/functional/page_objects/accountsetting_page.js
This file contains 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,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
//import { map as mapAsync } from 'bluebird'; | ||
import expect from 'expect.js'; | ||
|
||
export function AccountSettingProvider({ getService }) { | ||
const testSubjects = getService('testSubjects'); | ||
|
||
class AccountSettingsPage { | ||
async verifyAccountSettings(expectedEmail, expectedUserName) { | ||
await testSubjects.click('loggedInUser'); | ||
const usernameField = await testSubjects.find('usernameField'); | ||
const userName = await usernameField.getVisibleText(); | ||
expect(userName).to.be(expectedUserName); | ||
const emailIdField = await testSubjects.find('emailIdField'); | ||
const emailField = await emailIdField.getVisibleText(); | ||
expect(emailField).to.be(expectedEmail); | ||
} | ||
|
||
async changePassword(currentPassword, newPassword) { | ||
await testSubjects.click('changePasswordLink'); | ||
await testSubjects.setValue('newPasswordInput', newPassword); | ||
await testSubjects.setValue('currentPasswordInput', currentPassword); | ||
await testSubjects.setValue('confirmPasswordInput', newPassword); | ||
await testSubjects.click('saveChangesButton'); | ||
await testSubjects.existOrFail('passwordUpdateSuccess'); | ||
} | ||
} | ||
return new AccountSettingsPage(); | ||
} |
This file contains 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
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.
This test is already in
x-pack/test/functional/apps/security/users.js:
. I think you started from that file and forgot to take this out?