Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Ext.define('AM.twoFA.controller.wizard.TwoFATracking', {
  2.     extend: 'Ext.app.Controller',
  3.     config: {
  4.         passwordCounter: 0,
  5.         verifyCounter: 0
  6.     },
  7.     refs: [
  8.         {
  9.             ref: 'wizardModalContainer',
  10.             selector: 'wizard-container'
  11.         },
  12.         {
  13.             ref: '2faEnterpassword',
  14.             selector: '2fa-enterpassword'
  15.         }
  16.     ],
  17.     init: function() {
  18.         this.control({
  19.             'welcome-step': {
  20.                 activate: this.wizardContainerAfterrender
  21.             },
  22.             'login-welcome-step': {
  23.                 activate: this.wizardContainerAfterrender
  24.             },
  25.             '2fa-enterpassword': {
  26.                 activate: this.enterPasswordShown,
  27.                 afterrender: this.passwordAfterRender
  28.             },
  29.             'select-phone': {
  30.                 activate: this.selectPhoneActivate
  31.             },
  32.             'login-select-phone': {
  33.                 activate: this.selectPhoneActivate
  34.             },
  35.             'install-authenticator-app': {
  36.                 activate: this.installAppPageShown
  37.             },
  38.             'setup-authenticator-app': {
  39.                 activate: this.setupAppPageShown
  40.             },
  41.             'setup-authenticator-app button-graphite-blue': {
  42.                 click: this.setupAppPageVerifyClick
  43.             },
  44.             'enable-verification-step': {
  45.                 activate: this.verificationCodePageShown
  46.             }
  47.         });
  48.     },
  49.     _pageShowerTracker: function(page, extra){
  50.         var params = {
  51.             element: 'page',
  52.             event: 'shown',
  53.             page: page
  54.         };
  55.         Ext.apply(params, extra);
  56.         this._wizardTracker(params);
  57.     },
  58.     _wizardTracker: function(params) {
  59.         Ext.apply(params, {
  60.             area: 'profile',
  61.             'logic_block': '2fa_login',
  62.             frame: 'wizard'
  63.         });
  64.         AM.uitracker.track(params);
  65.     },
  66.     _initCounters: function() {
  67.         this.config.passwordCounter = 0;
  68.         this.config.verifyCounter = 0;
  69.     },
  70.     wizardContainerAfterrender: function() {
  71.         this._initCounters();
  72.         this._pageShowerTracker('enable_2fa');
  73.     },
  74.     passwordAfterRender: function(view) {
  75.         view.el.select('.js-next').on('click', this.passwordNextClick, this);
  76.     },
  77.     passwordNextClick: function() {
  78.         this.config.passwordCounter++;
  79.         var params = {
  80.             page: 'enter_password',
  81.             element: 'continue_button',
  82.             event: 'click',
  83.             value: this.config.passwordCounter
  84.         };
  85.         this._wizardTracker(params);
  86.     },
  87.     enterPasswordShown: function() {
  88.         this._pageShowerTracker('enter_password');
  89.     },
  90.     selectPhoneActivate: function(){
  91.         this._pageShowerTracker('phone_selection_2fa');
  92.     },
  93.     installAppPageShown: function(){
  94.         this._pageShowerTracker('app_install_offer');
  95.     },
  96.     setupAppPageShown: function(){
  97.         this._pageShowerTracker('qr_code_app_set_up');
  98.     },
  99.     setupAppPageVerifyClick: function() {
  100.         this.config.verifyCounter++;
  101.         var params = {
  102.             page: 'qr_code_app_set_up',
  103.             element: 'verify_button',
  104.             event: 'click',
  105.             value: this.config.verifyCounter
  106.         };
  107.         this._wizardTracker(params);
  108.     },
  109.     verificationCodePageShown: function() {
  110.         this._pageShowerTracker('recovery_code_info');
  111.     }
  112. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement