Merge branch 'master' into auth-flow

Conflicts:
	client/coral-admin/src/actions/auth.js
This commit is contained in:
Chi Vinh Le
2017-05-27 01:07:19 +07:00
6 changed files with 18 additions and 9 deletions
+2
View File
@@ -58,6 +58,8 @@ alternative methods of loading configuration during development.
- iPad
- iPad Pro
- iPhone 7 Plus
- iPhone 7
- iPhone 6 Plus
- iPhone 6
- iPhone 5
+3 -1
View File
@@ -68,7 +68,9 @@ const forgotPassowordFailure = () => ({
export const requestPasswordReset = (email) => (dispatch) => {
dispatch(forgotPassowordRequest(email));
return coralApi('/account/password/reset', {method: 'POST', body: {email}})
const redirectUri = location.href;
return coralApi('/account/password/reset', {method: 'POST', body: {email, loc: redirectUri}})
.then(() => dispatch(forgotPassowordSuccess()))
.catch((error) => dispatch(forgotPassowordFailure(error)));
};
+1 -1
View File
@@ -86,7 +86,7 @@ const RootQuery = {
// this returns an arbitrary user
user(_, {id}, {user, loaders: {Users}}) {
if (user == null || !user.hasRoles('ADMIN')) {
if (user == null || !user.can(SEARCH_OTHER_USERS)) {
return null;
}
+11 -5
View File
@@ -1,5 +1,11 @@
const KarmaService = require('../../services/karma');
const {SEARCH_ACTIONS, SEARCH_OTHERS_COMMENTS, UPDATE_USER_ROLES} = require('../../perms/constants');
const {
SEARCH_ACTIONS,
SEARCH_OTHER_USERS,
SEARCH_OTHERS_COMMENTS,
UPDATE_USER_ROLES,
SEARCH_COMMENT_METRICS
} = require('../../perms/constants');
const User = {
action_summaries({id}, _, {loaders: {Actions}}) {
@@ -14,7 +20,7 @@ const User = {
},
created_at({roles, created_at}, _, {user}) {
if (user && user.hasRoles('ADMIN')) {
if (user && user.can(SEARCH_OTHER_USERS)) {
return created_at;
}
@@ -33,7 +39,7 @@ const User = {
profiles({profiles}, _, {user}) {
// if the user is not an admin, do not return the profiles
if (user && user.hasRoles('ADMIN')) {
if (user && user.can(SEARCH_OTHER_USERS)) {
return profiles;
}
@@ -43,7 +49,7 @@ const User = {
// Only allow a logged in user that is either the current user or is a staff
// member to access the ignoredUsers of a given user.
if (!user || ((user.id !== id) && !(user.hasRoles('ADMIN') || user.hasRoles('MODERATOR')))) {
if (!user || ((user.id !== id) && !user.can(SEARCH_OTHER_USERS))) {
return null;
}
@@ -66,7 +72,7 @@ const User = {
// Extract the reliability from the user metadata if they have permission.
reliable(user, _, {user: requestingUser}) {
if (requestingUser && requestingUser.hasRoles('ADMIN')) {
if (requestingUser && requestingUser.can(SEARCH_COMMENT_METRICS)) {
return KarmaService.model(user);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "talk",
"version": "1.6.0",
"version": "1.7.0",
"description": "A better commenting experience from Mozilla, The New York Times, and the Washington Post. https://coralproject.net",
"main": "app.js",
"scripts": {
-1
View File
@@ -566,7 +566,6 @@ module.exports = class UsersService {
// endpoint.
return;
}
let redirectDomain;
try {
redirectDomain = url.parse(loc).hostname;