Getting a success message in place

This commit is contained in:
Will Marshall
2014-03-27 16:26:22 +11:00
parent 54491e0de2
commit 08c25b1604
2 changed files with 23 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser) ->
$scope.spree_user = SpreeUser.spree_user
$scope.sent = false
$scope.active = ->
$location.path() == '/forgot'
@@ -10,9 +11,7 @@ window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $h
$scope.submit = ->
if $scope.spree_user.email != null
$http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).success (data)->
$location.path("/reset")
$scope.sent = true
.error (data) ->
$scope.errors = "Email address not found"
else

View File

@@ -4,18 +4,26 @@
select: "select()"}
%form{"ng-submit" => "submit()"}
.alert-box.alert{"ng-show" => "errors != null"}
{{ errors }}
.row
.large-12.columns
%label{for: "email"} Email
%input.title.input-text{name: "email",
type: "email",
tabindex: 1,
"ng-model" => "spree_user.email"}
.row
.large-12.columns
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
value: "Reset password"}
.alert-box.success.radius{"ng-show" => "sent"}
An email with instructions on resetting your password has been sent!
%div{"ng-show" => "!sent"}
.alert-box.alert{"ng-show" => "errors != null"}
{{ errors }}
.row
.large-12.columns
%label{for: "email"} Email
%input.title.input-text{name: "email",
type: "email",
tabindex: 1,
"ng-model" => "spree_user.email"}
.row
.large-12.columns
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
value: "Reset password"}