This repository has been archived by the owner on May 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(email): add validate account page
- Loading branch information
Alexander Salas Bastidas
committed
Jan 20, 2017
1 parent
05ad49c
commit 2f49dcb
Showing
8 changed files
with
109 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
/** | ||
* @ngdoc function | ||
* @name FlyveMDM.controller:AccountValidationCtrl | ||
* @description | ||
* # AccountValidationCtrl | ||
* Controller of the FlyveMDM | ||
*/ | ||
angular.module('FlyveMDM') | ||
.controller('AccountValidationCtrl', function ($scope, AuthProvider, AccountFac, Notifications, $state, $stateParams) { | ||
$scope.lock_submit = false; | ||
$scope.show_login = false; | ||
$scope.validateAccount = function () { | ||
$scope.lock_submit = true; | ||
AccountFac.validateAccount($stateParams.id, $stateParams.hash) | ||
.then(function () { | ||
Notifications.done("Account validated"); | ||
$scope.show_login = true; | ||
}, function () { | ||
$scope.lock_submit = false; | ||
}); | ||
}; | ||
$scope.goToLogin = function () { | ||
$state.go('login'); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc service | ||
* @name FlyveMDM.AccountFac | ||
* @description | ||
* # AccountFac | ||
* Factory in the FlyveMDM. | ||
*/ | ||
angular.module('FlyveMDM') | ||
.factory('AccountFac', function (GLPI_API_URL, PluginObjectNames, AuthProvider, $q, $http) { | ||
// Service logic | ||
// Public API here | ||
return { | ||
validateAccount: function (id, hash) { | ||
var defer = $q.defer(); | ||
AuthProvider.getTempSessionToken().then(function (temp_session_token) { | ||
$http({ | ||
method: 'PUT', | ||
url: GLPI_API_URL + PluginObjectNames.AccountValidation, | ||
data: { | ||
input: { | ||
id: id, | ||
_validate: hash | ||
} | ||
}, | ||
headers: { | ||
'Session-Token': temp_session_token | ||
} | ||
}).then(function (response) { | ||
defer.resolve(response.data); | ||
}, function () { | ||
defer.reject(); | ||
}); | ||
}, function () { | ||
defer.reject(); | ||
}); | ||
return defer.promise; | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<section class="login-page"> | ||
<div class="container" layout="column" layout-padding="" layout-wrap="" layout-fill="" ng-cloak=""> | ||
<md-card class="login-card"> | ||
<img ng-src="images/logo-flyve-login.png" class="md-card-image" alt="Flyve MDM Logo"> | ||
<md-card-actions layout="row" layout-align="center center"> | ||
<md-button ng-click="goToLogin($event)" ng-if="show_login">Login page</md-button> | ||
<md-button class="md-raised md-primary" ng-click="validateAccount($event)" ng-disabled="lock_submit" ng-if="!show_login">Validate account</md-button> | ||
</md-card-actions> | ||
</md-card> | ||
</div> | ||
|
||
<div class="md-body-1 layout-margin foo" layout="row" layout-align="end center"> | ||
<p>A solution powered by</p> | ||
<a href="http://teclib-edition.com/en/" target=_blank title="Teclib'' Web Site"><img src="images/logo-teclib-blanc-1-2.png" alt="Flyve Logo" height="24"></a> | ||
</div> | ||
</section> |