Produced by Araxis Merge on 12/7/2018 11:36:01 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\SCRUB\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\models | user-session.js | Mon Oct 22 23:25:20 2018 UTC |
| 2 | C:\MHED-scrubbed\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\models | user-session.js | Fri Dec 7 13:07:10 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 222 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | define([ | |
| 2 | 'under score', | |
| 3 | 'model s/singleto n-model', | |
| 4 | 'Vent' , | |
| 5 | 'jwt_d ecode', | |
| 6 | ], | |
| 7 | function(_ , Model, v ent, jwtDe code) { | |
| 8 | 'use s trict'; | |
| 9 | ||
| 10 | var Us erSession = Model.ex tend({ | |
| 11 | re sourceName : 'public- user-sessi on', | |
| 12 | ||
| 13 | in itialize: function(o ptions) { | |
| 14 | this.jwt TokenUrl = options.j wtTokenUrl ; | |
| 15 | }, | |
| 16 | is LoggedIn: function() { | |
| 17 | return t his.get('a uthenticat ed'); | |
| 18 | }, | |
| 19 | st artSession Timer: fun ction() { | |
| 20 | this._se ssionTimer (); | |
| 21 | this._se ssionTimer = _.noop; | |
| 22 | }, | |
| 23 | _s essionTime r: functio n() { | |
| 24 | var self = this; | |
| 25 | var oneS econd = 10 00; | |
| 26 | var oneM inute = 60 000; | |
| 27 | var twoM inutes = 1 20000; | |
| 28 | var thre eMinutes = 180000; | |
| 29 | var time ToExpire = 0; | |
| 30 | var coun tdownTimer ; | |
| 31 | var wait Time; | |
| 32 | var sess ionEnded = false; | |
| 33 | ||
| 34 | function checksess ion() { | |
| 35 | var encode dJwtToken = getCooki e(' DNS '); | |
| 36 | var jwtCookie; | |
| 37 | ||
| 38 | if ( encodedJwt Token === null) { | |
| 39 | vent.trigg er('show:s ession:exp ired'); | |
| 40 | return; | |
| 41 | } | |
| 42 | ||
| 43 | jwtC ookie = jw tDecode(en codedJwtTo ken); | |
| 44 | time ToExpire = (jwtCooki e.exp * on eSecond) - new Date( ).getTime( ); | |
| 45 | ||
| 46 | if ( timeToExpi re <= thre eMinutes) { | |
| 47 | showTimeou tModal(tim eToExpire) ; | |
| 48 | } | |
| 49 | wait Time = tim eToNearest Minute(tim eToExpire) ; | |
| 50 | ||
| 51 | if ( !sessionEn ded) { | |
| 52 | clearTimeo ut(countdo wnTimer); | |
| 53 | countdownT imer = set Timeout(fu nction() { | |
| 54 | checks ession(); | |
| 55 | }, waitTim e); | |
| 56 | } el se { | |
| 57 | vent.trigg er('show:s ession:exp ired'); | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | // Taken from: htt ps://www.w 3schools.c om/js/js_c ookies.asp | |
| 62 | function getCookie (cname) { | |
| 63 | var name = cna me + '='; | |
| 64 | var decodedCoo kie = deco deURICompo nent(docum ent.cookie ); | |
| 65 | var ca = decod edCookie.s plit(';'); | |
| 66 | var i; | |
| 67 | var c; | |
| 68 | ||
| 69 | for (i = 0; i < ca.lengt h; i++) { | |
| 70 | c = ca[i]; | |
| 71 | while (c.c harAt(0) = == ' ') { | |
| 72 | c = c. substring( 1); | |
| 73 | } | |
| 74 | if (c.inde xOf(name) === 0) { | |
| 75 | return c.substri ng(name.le ngth, c.le ngth); | |
| 76 | } | |
| 77 | } | |
| 78 | retu rn null; | |
| 79 | } | |
| 80 | ||
| 81 | function timeToNea restMinute (_timeToEx pire) { | |
| 82 | if ( _timeToExp ire > thre eMinutes) { | |
| 83 | return _ti meToExpire - threeMi nutes; | |
| 84 | } el se if (_ti meToExpire > twoMinu tes) { | |
| 85 | return _ti meToExpire - twoMinu tes; | |
| 86 | } el se if (_ti meToExpire > oneMinu te) { | |
| 87 | return _ti meToExpire - oneMinu te; | |
| 88 | } | |
| 89 | ||
| 90 | retu rn _timeTo Expire; | |
| 91 | ||
| 92 | } | |
| 93 | ||
| 94 | function showTimeo utModal(_t imeToExpir e) { | |
| 95 | var minutesToE xpire = Ma th.round(p arseInt(_t imeToExpir e, 10) / o neMinute); | |
| 96 | ||
| 97 | if ( minutesToE xpire <= 0 ) { | |
| 98 | sessionEnd ed = true; | |
| 99 | vent.trigg er('show:s ession:exp ired'); | |
| 100 | } el se { | |
| 101 | self.set(' sessionTim eoutIn', ' Your user session wi ll time ou t in ' + | |
| 102 | minute sToExpire + ' minute ' + (minut esToExpire > 1 ? 's. ' : '.')); | |
| 103 | vent.trigg er('show:s ession:war ning'); | |
| 104 | } | |
| 105 | } | |
| 106 | ||
| 107 | ||
| 108 | checkses sion(); | |
| 109 | }, | |
| 110 | }); | |
| 111 | return UserSessi on; | |
| 112 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.