Skip to content

Commit

Permalink
Merge pull request #589 from axsh/fix-accountless-gui-crash
Browse files Browse the repository at this point in the history
Fix accountless GUI crash
  • Loading branch information
Metallion committed May 25, 2015
2 parents bfb5438 + b661b3e commit 86e037a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/dcmgr_gui/app/controllers/sessions_controller.rb
Expand Up @@ -41,7 +41,7 @@ def create
end
user = User.authenticate(params[:login], params[:password])

if user
if user && user.primary_account
self.current_user = user
user.update_last_login
redirect_back_or_default('/', :notice => "Logged in successfully")
Expand Down
2 changes: 1 addition & 1 deletion frontend/dcmgr_gui/app/models/user.rb
Expand Up @@ -37,7 +37,7 @@ def before_destroy
end

def is_system_manager?
self.primary_account.is_admin
!! (self.primary_account && self.primary_account.is_admin)
end

def primary_account
Expand Down

0 comments on commit 86e037a

Please sign in to comment.