Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Cimplex 108 posts 570 karma points
    Oct 23, 2019 @ 18:46

    2FA - Umbraco 8 - Redirect to backoffice after successful code


    We have two factor authentication enabled for our Umbraco site, in Umbraco 7 we used this code snippet to verify the 2fa code:

    authResource.verify2FACode(provider, code)
                    .then(function (data) {
                    }, function(response) {
                        $scope.error = true;

    Now the $scope.submit(true) throws a error:

    TypeError: $scope.submit is not a function

    And the user is not redirected to the backoffice. If the page is reloaded manually (F5) the backoffice appear as expected, means that the cookie is set correctly.

    Any ideas how to solve this?

    / Herman

  • Thomas Maassen 3 posts 73 karma points
    Jan 13, 2020 @ 12:38
    Thomas Maassen

    I think this means angularJs does not have a built in function for $scope.submit anymore, but not sure.

    I have been working on a 2fa package for Umbraco 8 that will we released later this week or next week and I solved this by using a different function to refresh the page.

    I hardcoded the backoffice URL and allowed that URL to be changed in a constants file. If you swap $scope.submit for this line it should work:

    $window.location.href = '/umbraco';

    For this to work you will have to inject $window in your controller like you did with $scope and authResource. If you have a different backoffice URL you should ofcourse put that in the string instead of /umbraco

  • Cimplex 108 posts 570 karma points
    Jan 14, 2020 @ 08:57

    Hi Thomas,

    Thanks for the reply, that's how i solved it as well, bad thing about this is if your automatically logged out from Umbraco all your changes will be gone because of the redirect.

    // Herman

  • Thomas Maassen 3 posts 73 karma points
    Jan 14, 2020 @ 09:21
    Thomas Maassen

    It's not my favorite solution either, but it's the only one I could get to work. Normally i use a different method in the angular controllers to refresh the page:$route.reload(). But when i use that method in the login controler it updates the URL but it doesn't refresh the view so for now this seems to be the only way

  • Joep 71 posts 471 karma points
    Mar 10, 2020 @ 15:55


    Someone found a way without reloading the page. For more info look at this issue:


  • Cimplex 108 posts 570 karma points
    Mar 11, 2020 @ 08:17

    Works like a charm, thanks for sharing!

Please Sign in or register to post replies

Write your reply to: