Skip to content

Commit

Permalink
Fixed flash messages for bad login
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoynter committed Jul 4, 2016
1 parent 91ad775 commit 938a7f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/templates/sign_up_in.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div class="row">
<notices class="col-md-10 col-md-offset-1"></notices>
</div>

<div data-ng-controller="UserController" class="col-md-4 col-md-offset-4">

<!-- Nav tabs -->
Expand Down
9 changes: 5 additions & 4 deletions app/assets/javascripts/users.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ users.controller(
$scope.sign_in = (cred)->
$scope.user.set('email', cred.email)
$scope.user.sign_in(cred.password).then(->
$location.path '/instruments'
$location.path '/instruments'
,->
$scope.publish_flash()
cred.password = ""
Expand All @@ -26,7 +26,7 @@ users.controller(
$scope.user.set('group_id', details.group)
$scope.user.sign_up(details.password, details.confirm).then(->
$location.path '/instruments'
true
true
,->
$scope.publish_flash()
details.password = ""
Expand All @@ -44,8 +44,9 @@ users.factory(
'User',
[
'$http',
'$q',
'Flash'
($http, Flash)->
($http, $q, Flash)->
class
constructor: (@email)->
@logged_in = false
Expand Down Expand Up @@ -81,7 +82,7 @@ users.factory(
,(res)->
self.logged_in = false
Flash.add 'danger', res.data.error
false
$q.reject res.data.error
)

sign_out: ->
Expand Down

0 comments on commit 938a7f0

Please sign in to comment.