2014-07-23 17:10:02 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2014-11-29 18:35:48 -03:00
|
|
|
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, notification, identityService, Compatibility) {
|
2014-11-01 21:34:03 -03:00
|
|
|
// This is only for backwards compat, insight api should link to #!/confirmed directly
|
|
|
|
|
if (getParam('confirmed')) {
|
|
|
|
|
var hashIndex = window.location.href.indexOf('/?');
|
|
|
|
|
window.location = window.location.href.substr(0, hashIndex) + '#!/confirmed';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($rootScope.fromEmailConfirmation) {
|
|
|
|
|
$scope.confirmedEmail = true;
|
|
|
|
|
$rootScope.fromEmailConfirmation = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-30 16:13:56 -03:00
|
|
|
Compatibility.check($scope);
|
|
|
|
|
|
2014-10-01 08:35:17 -03:00
|
|
|
$scope.openProfile = function(form) {
|
2014-11-01 21:34:03 -03:00
|
|
|
$scope.confirmedEmail = false;
|
2014-10-09 18:53:31 -03:00
|
|
|
if (form && form.$invalid) {
|
2014-11-01 21:34:03 -03:00
|
|
|
$scope.error = 'Please enter the required fields';
|
2014-10-09 18:53:31 -03:00
|
|
|
return;
|
|
|
|
|
}
|
2014-10-28 18:06:32 -03:00
|
|
|
identityService.open($scope, form);
|
2014-10-01 08:35:17 -03:00
|
|
|
}
|
2014-10-30 12:06:48 -03:00
|
|
|
|
|
|
|
|
function getParam(sname) {
|
|
|
|
|
var params = location.search.substr(location.search.indexOf("?") + 1);
|
|
|
|
|
var sval = "";
|
|
|
|
|
params = params.split("&");
|
|
|
|
|
// split param and value into individual pieces
|
|
|
|
|
for (var i = 0; i < params.length; i++) {
|
|
|
|
|
var temp = params[i].split("=");
|
|
|
|
|
if ([temp[0]] == sname) {
|
|
|
|
|
sval = temp[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return sval;
|
|
|
|
|
}
|
2014-09-03 01:25:08 -03:00
|
|
|
});
|