@@ -45,8 +45,7 @@ import {
4545 OAUTH_DOMAIN ,
4646 OAUTH_PROVIDER ,
4747 LATEST_CS_VERSION ,
48- PASSWORD_CHANGE_REQUIRED ,
49- LOGIN_SOURCE
48+ PASSWORD_CHANGE_REQUIRED
5049} from '@/store/mutation-types'
5150
5251import {
@@ -83,8 +82,7 @@ const user = {
8382 twoFaIssuer : '' ,
8483 customHypervisorName : 'Custom' ,
8584 readyForShutdownPollingJob : '' ,
86- passwordChangeRequired : false ,
87- loginSource : ''
85+ passwordChangeRequired : false
8886 } ,
8987
9088 mutations : {
@@ -204,13 +202,10 @@ const user = {
204202 SET_PASSWORD_CHANGE_REQUIRED : ( state , required ) => {
205203 state . passwordChangeRequired = required
206204 if ( required ) {
207- vueProps . $localStorage . set ( ' PASSWORD_CHANGE_REQUIRED' , ' true' )
205+ vueProps . $localStorage . set ( PASSWORD_CHANGE_REQUIRED , true )
208206 } else {
209- vueProps . $localStorage . remove ( ' PASSWORD_CHANGE_REQUIRED' )
207+ vueProps . $localStorage . remove ( PASSWORD_CHANGE_REQUIRED )
210208 }
211- } ,
212- SET_LOGIN_SOURCE : ( state , source ) => {
213- vueProps . $localStorage . set ( 'LOGIN_SOURCE' , source )
214209 }
215210 } ,
216211
@@ -259,8 +254,7 @@ const user = {
259254 if ( result && result . managementserverid ) {
260255 commit ( 'SET_MS_ID' , result . managementserverid )
261256 }
262- commit ( 'SET_LOGIN_SOURCE' , 'password' )
263- if ( result . passwordchangerequired && result . passwordchangerequired === 'true' ) {
257+ if ( result . passwordchangerequired ) {
264258 commit ( 'SET_PASSWORD_CHANGE_REQUIRED' , true )
265259 commit ( 'SET_APIS' , { } )
266260 vueProps . $localStorage . remove ( APIS )
@@ -321,8 +315,6 @@ const user = {
321315 const latestVersion = vueProps . $localStorage . get ( LATEST_CS_VERSION , { version : '' , fetchedTs : 0 } )
322316 commit ( 'SET_LATEST_VERSION' , latestVersion )
323317 notification . destroy ( )
324- commit ( 'SET_LOGIN_SOURCE' , 'oauth' )
325- commit ( 'SET_PASSWORD_CHANGE_REQUIRED' , false )
326318 resolve ( )
327319 } ) . catch ( error => {
328320 reject ( error )
@@ -349,11 +341,9 @@ const user = {
349341 commit ( 'SET_LATEST_VERSION' , latestVersion )
350342
351343 // This block is to enforce password change for first time login after admin resets password
352- const loginSource = vueProps . $localStorage . get ( LOGIN_SOURCE )
353- const isPwdChangeRequired = vueProps . $localStorage . get ( PASSWORD_CHANGE_REQUIRED ) === 'true'
354- const isPwdChangeRequiredForLogin = ( loginSource === 'password' && isPwdChangeRequired )
355- commit ( 'SET_PASSWORD_CHANGE_REQUIRED' , isPwdChangeRequiredForLogin )
356- if ( isPwdChangeRequiredForLogin ) {
344+ const isPwdChangeRequired = vueProps . $localStorage . get ( PASSWORD_CHANGE_REQUIRED )
345+ commit ( 'SET_PASSWORD_CHANGE_REQUIRED' , isPwdChangeRequired )
346+ if ( isPwdChangeRequired ) {
357347 getAPI ( 'listUsers' , { id : Cookies . get ( 'userid' ) } ) . then ( response => {
358348 const result = response . listusersresponse . user [ 0 ]
359349 commit ( 'SET_INFO' , result )
@@ -529,9 +519,7 @@ const user = {
529519 vueProps . $localStorage . remove ( HEADER_NOTICES )
530520
531521 vueProps . $localStorage . remove ( PASSWORD_CHANGE_REQUIRED )
532- vueProps . $localStorage . remove ( LOGIN_SOURCE )
533522 commit ( 'SET_PASSWORD_CHANGE_REQUIRED' , false )
534- commit ( 'SET_LOGIN_SOURCE' , '' )
535523
536524 logout ( state . token ) . then ( ( ) => {
537525 message . destroy ( )
0 commit comments