initial look at indicating if user is not the owner

this does not fully work as the server does not update `isOwner` in the client when the user authenticates.
This commit is contained in:
Paul Rodwell 2016-11-30 10:29:38 +00:00
parent f7f34b2223
commit d84a282bb3
3 changed files with 10 additions and 3 deletions

View File

@ -51,7 +51,13 @@ update_footer = (ownerName, isAuthenticated) ->
$('footer > #security').empty()
if isAuthenticated
$('footer > #security').append "<a href='#' id='logout' class='footer-item' title='Sign-out'><i class='fa fa-unlock fa-lg fa-fw'></i></a>"
if isOwner
logoutTitle = "Sign-out"
logoutIconClass = ''
else
logoutTitle = "Not Owner : Sign-out"
logoutIconClass = 'notOwner'
$('footer > #security').append "<a href='#' id='logout' class='footer-item' title='#{logoutTitle}'><i class='fa fa-unlock fa-lg fa-fw #{logoutIconClass}'></i></a>"
$('footer > #security > #logout').click (e) ->
e.preventDefault()
myInit = {

View File

@ -8,6 +8,6 @@
color: floralwhite;
}
#isOwner {
color: green;
.notOwner {
transform: rotate(20deg);
}

View File

@ -133,6 +133,7 @@ module.exports = exports = (log, loga, argv) ->
else
try
idProvider = _.head(_.keys(req.session.passport.user))
console.log 'idProvider: ', idProvider
switch idProvider
when 'github', 'google', 'twitter'
if _.isEqual(owner[idProvider].id, req.session.passport.user[idProvider].id)