mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-06-13 09:01:29 +02:00
feat(core): add notification feedback with angular-ui-notification (#1532)
Added visual notification for user/article updates angular-ui-notification config added to core client config Notification idea from #369
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
.module('users')
|
||||
.controller('AuthenticationController', AuthenticationController);
|
||||
|
||||
AuthenticationController.$inject = ['$scope', '$state', 'UsersService', '$location', '$window', 'Authentication', 'PasswordValidator'];
|
||||
AuthenticationController.$inject = ['$scope', '$state', 'UsersService', '$location', '$window', 'Authentication', 'PasswordValidator', 'Notification'];
|
||||
|
||||
function AuthenticationController($scope, $state, UsersService, $location, $window, Authentication, PasswordValidator) {
|
||||
function AuthenticationController($scope, $state, UsersService, $location, $window, Authentication, PasswordValidator, Notification) {
|
||||
var vm = this;
|
||||
|
||||
vm.authentication = Authentication;
|
||||
@@ -17,7 +17,9 @@
|
||||
vm.callOauthProvider = callOauthProvider;
|
||||
|
||||
// Get an eventual error defined in the URL query string:
|
||||
vm.error = $location.search().err;
|
||||
if ($location.search().err) {
|
||||
Notification.error({ message: $location.search().err });
|
||||
}
|
||||
|
||||
// If user is signed in then redirect back home
|
||||
if (vm.authentication.user) {
|
||||
@@ -25,7 +27,6 @@
|
||||
}
|
||||
|
||||
function signup(isValid) {
|
||||
vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
@@ -39,7 +40,6 @@
|
||||
}
|
||||
|
||||
function signin(isValid) {
|
||||
vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
@@ -67,25 +67,25 @@
|
||||
function onUserSignupSuccess(response) {
|
||||
// If successful we assign the response to the global user model
|
||||
vm.authentication.user = response;
|
||||
|
||||
Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Signup successful!' });
|
||||
// And redirect to the previous or home page
|
||||
$state.go($state.previous.state.name || 'home', $state.previous.params);
|
||||
}
|
||||
|
||||
function onUserSignupError(response) {
|
||||
vm.error = response.data.message;
|
||||
Notification.error({ message: response.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Signup Error!', delay: 6000 });
|
||||
}
|
||||
|
||||
function onUserSigninSuccess(response) {
|
||||
// If successful we assign the response to the global user model
|
||||
vm.authentication.user = response;
|
||||
|
||||
Notification.info({ message: 'Welcome ' + response.firstName });
|
||||
// And redirect to the previous or home page
|
||||
$state.go($state.previous.state.name || 'home', $state.previous.params);
|
||||
}
|
||||
|
||||
function onUserSigninError(response) {
|
||||
vm.error = response.data.message;
|
||||
Notification.error({ message: response.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Signin Error!', delay: 6000 });
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user