-
Notifications
You must be signed in to change notification settings - Fork 34
Bugfix/ask email confirmation when adding organisation manager #3398
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
Bugfix/ask email confirmation when adding organisation manager #3398
Conversation
Fix the following: |
@deligence-dharmendra @matleppa I was trying to test the fix from my localhost. |
@Nazarah Yes, you need to set up valid email configuration information. Otherwise, email id does not add to the organization and its show error message as an s-alert on the same page. |
@deligence-dharmendra @matleppa Just ran the feature in my localhost. |
@@ -22,6 +22,12 @@ AutoForm.hooks({ | |||
|
|||
// Add current user as Organization manager & creater | |||
organization.managerIds = [userId]; | |||
organization.emailVerification = []; | |||
// Set default value for the owner of organization | |||
organization.emailVerification.push({ |
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.
What about:
organization.emailVerification = [{....}];
?
{{/ if }} | ||
<div class="pull-right"> | ||
{{# unless emailVerified }} | ||
<span class="label label-default">Unverified</span> |
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.
- i18n tag for this word is missed
- Nested element should have a new line
// Get email verification status | ||
const result = _.find(organization.emailVerification, { managerIds: user._id }); | ||
// In case of existing organizations | ||
if (typeof result === 'undefined') { |
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.
Make invert of this if-else & simplify
// Construct empty object
let verificationData = {};
const result = _.find(organization.emailVerification, { managerIds: user._id });
if (result) {
varidicationData = result
} else {
verificationData.verified = organization.createdBy === user._id;
}
If organization.emailVerification
is undefined
then result
variable is undefined
as well
Remake
@deligence-dharmendra I agree with @Nazarah about User getting redirected to Organization page while verificating. |
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.
Some findings.
const response = Meteor.call('sendEmailVerification', user._id); | ||
|
||
// Check error type | ||
if (response.message === 'failed' && response.message === 'email-failed') { |
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.
Combine checks.
Outer check
response.status === 'failed'
inner checks
response.message === 'email-failed'
response.message === 'mail-setting-invalid'
return resp; | ||
} else { | ||
// Throw Authentication error for client | ||
throw new Meteor.Error(`Email verification failed. Authentication token doesn't exists in db.`); |
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.
exists --> exist
2428080
to
08156d1
Compare
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.
@deligence-dharmendra Great job 👍 Work as expected
I made rebase
to squash your commit
08156d1
to
a61f014
Compare
Closes #3346
Changes
Developer checklist
This checklist is to be completed by the PR developer:
Reviewer checklist
Reviewed by: @username1
This list is to be completed by the pull request reviewer: