Skip to content

Commit

Permalink
Add success message for already signed up users
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwofford committed Jan 24, 2016
1 parent c1e2d1e commit b91a58d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/assets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ body.addEventListener('submit', function(ev){
button.className = '';
button.innerHTML = 'Please Wait';
var channel = select ? select.value : null;
invite(channel, coc && coc.checked ? 1 : 0, input.value, function(err){
invite(channel, coc && coc.checked ? 1 : 0, input.value, function(err, msg){
if (err) {
button.removeAttribute('disabled');
button.className = 'error';
button.innerHTML = err.message;
} else {
button.className = 'success';
button.innerHTML = 'WOOT. Check your email!';
button.innerHTML = msg;
}
});
});
Expand All @@ -51,7 +51,7 @@ function invite(channel, coc, email, fn){
var err = new Error(res.body.msg || 'Server error');
return fn(err);
} else {
fn(null);
fn(null, res.body.msg);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function slackin({

invite({ token, org, email, channel: chanId }, err => {
if (err) {
if (err.redirectUrl) {
if (err.message === `Already invited. Sending you to https://${org}.slack.com...`) {
return res
.status(303)
.json({ msg: err.message, redirectUrl: `https://${org}.slack.com` });
Expand All @@ -136,7 +136,7 @@ export default function slackin({

res
.status(200)
.json({ msg: 'success' });
.json({ msg: 'WOOT. Check your email!' });
});
});

Expand Down

0 comments on commit b91a58d

Please sign in to comment.