How can I handle email confirmation URLs in Identity 2.1 SPA Angular JS app?

I saw an example that uses MVC. It has a return URL that contains a screen that is called from the sent message. But I have an AngularJS SPA application, so this is a little different. Someone tried to do this with SPA, and if so, how did they start to implement it. Any pointers would be much appreciated.

+4
source share
1 answer

I am working on it now; it takes more work to make it beautiful and much more, but I hope you get a general idea.

The confirmation URL is as follows:

http://localhost:8000/app.html#/confirm/9a28aa89e84e80153b1f2083d38911acbae12e8365dd13c83cee55f79481e1f8

(localhost: 8000, ). ui-router:

var confirm = {
    name: 'confirm',
    url: '/confirm/:auth',
    templateUrl: 'app/front/partial/confirm.html',
    params: {auth: {}}
    } ;
$stateProvider.state(confirm) ;

partial.html partial (, , !):

<div ng-controller="Fapi.Front.Confirm.Ctrl">
  CONFIRM
</div>

:

angular.module('myApp')
    .controller('App.Front.Confirm.Ctrl', [
        '$scope', '$state', '$stateParams', 'toaster', 'MyDataService',
        function ($scope, $state, $stateParams, toaster, MyDataService) {
            MyDataService.confirm (
                {auth: $stateParams.auth},
                function (data) {
                    toaster.pop('success', 'Your registration has been confirmed') ;
                    setTimeout(function () { $state.go('login') }, 5000) ;
                    },
                function (data) {
                    toaster.pop('error', data.message) ;
                    }
                )
        }]) ;

MyDataService - , $http- .

, "" , URL- script , , " " ( ), , AJAX .

+1

All Articles