Fix commit redirect for non signed user.

Now users will be directed to sign in page and on sign in
will have pledge completed
This commit is contained in:
Berkeley Martinez
2015-12-28 12:41:37 -08:00
parent 5c1d5f4ea6
commit 8c3e14cd8e
3 changed files with 23 additions and 11 deletions

View File

@@ -22,11 +22,16 @@ import {
ifNoUserRedirectTo
} from '../utils/middleware';
const sendNonUserToFront = ifNoUserRedirectTo('/');
const sendNonUserToSignIn = ifNoUserRedirectTo(
'/login',
'You must be signed in to commit to a non-profit'
);
const sendNonUserToCommit = ifNoUserRedirectTo(
'/commit',
'Must be signed in to update commit'
'You must be signed in to update commit'
);
const debug = debugFactory('freecc:commit');
function findNonprofit(name) {
@@ -52,7 +57,7 @@ export default function commit(app) {
router.get(
'/commit/pledge',
sendNonUserToFront,
sendNonUserToSignIn,
pledge
);