Skip to content

Commit bab0bce

Browse files
author
Ville Jyrkkä
committed
Solve conflict with accounts_hooks
2 parents 7e93be9 + c3f1c44 commit bab0bce

File tree

6 files changed

+110
-26
lines changed

6 files changed

+110
-26
lines changed

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at conduct@apinf.io. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ See the [high definition video (with music) of Apinf Development Activity up to
5050
You can preview our latest version at [nightly.apinf.io](http://nightly.apinf.io). Feel free to register an account and test things out.
5151

5252
# Contributing
53-
Please review our [Contributor Guide](https://github.com/apinf/docs/blob/master/docs/develop/contributing.md) for details on how to get involved with the project.
53+
Please review our [Contributor Guide](https://github.com/apinf/platform/blob/develop/CONTRIBUTING.md) for details on how to get involved with the project.
54+
55+
Please follow guidelines for community involvement in our [Code of Conduct](https://github.com/apinf/platform/blob/develop/CODE_OF_CONDUCT.md)

apis/client/view/details/details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h4>
6060
<!-- Proxy Backend is completed, "Disable api key" is false, user has got an api key -->
6161
<li>
6262
{{_ "apiDetails_usageInstructions_urlParameters_text" }}
63-
<i>{{ proxyUrl }}&lt;optional_path&gt;api_key={{ apiKey }}</i>
63+
<i>{{ proxyUrl }}&lt;optional_path&gt;?api_key={{ apiKey }}</i>
6464
</li>
6565
<li>
6666
{{_ "apiDetails_usageInstructions_requestHeaders_text" }}

apis/client/view/view.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Template.viewApi.onCreated(function () {
3232

3333
// Subscribe to authorized user public details
3434
instance.subscribe('apiAuthorizedUsersPublicDetails', instance.apiId);
35+
36+
// Subscribe to all users, returns only usernames
37+
instance.subscribe('allUsers');
3538
});
3639

3740
Template.viewApi.helpers({

users/server/accounts_hooks.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@ Accounts.onCreateUser((options, user) => {
55
// Create empty user profile if none exists
66
user.profile = user.profile || {};
77

8-
// Check for Github authentication
9-
if (user.services && user.services.github) {
10-
// Set user email address from Github email
11-
user.emails = [
12-
{
13-
address: user.services.github.email,
14-
verified: true,
15-
},
16-
];
17-
18-
// Search 'githubUsername' from database.
19-
const githubUsername = user.services.github.username;
20-
const existingUser = Meteor.users.findOne({ 'username': githubUsername });
21-
if (existingUser === undefined) {
22-
// Username available, set username to Github username.
23-
user.username = githubUsername;
24-
} else {
25-
// Username clashes with existing username, add prefix
26-
user.username = `gh-${githubUsername}`;
8+
// Check services object exists
9+
if (user.services) {
10+
// Case 1: Register with Github
11+
if (user.services.github) {
12+
// Set user email address from Github email
13+
user.emails = [
14+
{
15+
address: user.services.github.email,
16+
verified: true,
17+
},
18+
];
19+
// Search 'githubUsername' from database.
20+
const githubUsername = user.services.github.username;
21+
const existingUser = Meteor.users.findOne({ 'username': githubUsername });
22+
if (existingUser === undefined) {
23+
// Username available, set username to Github username.
24+
user.username = githubUsername;
25+
} else {
26+
// Username clashes with existing username, add prefix
27+
user.username = `gh-${githubUsername}`;
28+
}
29+
// Case 2: Register with local account, email verification required
30+
} else if (user.services.password) {
31+
// we wait for Meteor to create the user before sending an email
32+
Meteor.setTimeout(() => {
33+
Meteor.call('sendRegistrationEmailVerification', user._id);
34+
}, 2 * 1000);
2735
}
2836
}
2937

30-
// we wait for Meteor to create the user before sending an email
31-
Meteor.setTimeout(() => {
32-
Meteor.call('sendRegistrationEmailVerification', user._id);
33-
}, 2 * 1000);
34-
3538
return user;
3639
});

users/server/startup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Meteor } from 'meteor/meteor';
33
import { loginAttemptVerifier } from './login_verify';
44

55
Meteor.startup(() => {
6+
// In case of server restart, we need to set MAIL_URL
7+
Meteor.call('configureSmtpSettings');
68
// Toggle attach login attempt verifier function to account login
79
Accounts.validateLoginAttempt(loginAttemptVerifier);
810
});

0 commit comments

Comments
 (0)