Authentication page: automatic change tabs, keep login info.
This commit is contained in:
		
							parent
							
								
									f19d3f0f85
								
							
						
					
					
						commit
						041546279e
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -495,8 +495,9 @@ handleAction = case _ of
 | 
			
		|||
            handleAction $ Log $ ErrorLog "TODO: received a GotPermissionCheck message."
 | 
			
		||||
          (AuthD.GotPermissionSet _) -> do
 | 
			
		||||
            handleAction $ Log $ ErrorLog "Received a GotPermissionSet message."
 | 
			
		||||
          (AuthD.GotPasswordRecovered _) -> do
 | 
			
		||||
          m@(AuthD.GotPasswordRecovered _) -> do
 | 
			
		||||
            handleAction $ Log $ SuccessLog "your new password is now valid!"
 | 
			
		||||
            handleAction $ DispatchAuthDaemonMessage m
 | 
			
		||||
          m@(AuthD.GotMatchingUsers _) -> do
 | 
			
		||||
            { current_page } <- H.get
 | 
			
		||||
            case current_page of
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -375,9 +375,13 @@ handleAction = case _ of
 | 
			
		|||
    -- Store the current tab we are on and restore it when we reload.
 | 
			
		||||
    sessionstorage <- H.liftEffect $ Window.sessionStorage =<< HTML.window
 | 
			
		||||
    _ <- case current_tab of
 | 
			
		||||
      Auth                -> H.liftEffect $ Storage.setItem "current-auth-tab" "Auth"                sessionstorage
 | 
			
		||||
      Auth -> do
 | 
			
		||||
        H.modify_ \state -> state { authenticationForm { login = state.newPasswordForm.login } }
 | 
			
		||||
        H.liftEffect $ Storage.setItem "current-auth-tab" "Auth"                sessionstorage
 | 
			
		||||
      TabPasswordRecovery -> H.liftEffect $ Storage.setItem "current-auth-tab" "TabPasswordRecovery" sessionstorage
 | 
			
		||||
      Recovery            -> H.liftEffect $ Storage.setItem "current-auth-tab" "Recovery"            sessionstorage
 | 
			
		||||
      Recovery -> do
 | 
			
		||||
        H.modify_ \state -> state { newPasswordForm { login = state.passwordRecoveryForm.login } }
 | 
			
		||||
        H.liftEffect $ Storage.setItem "current-auth-tab" "Recovery"            sessionstorage
 | 
			
		||||
    H.modify_ _ { current_tab = current_tab }
 | 
			
		||||
 | 
			
		||||
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
 | 
			
		||||
| 
						 | 
				
			
			@ -386,6 +390,8 @@ handleQuery = case _ of
 | 
			
		|||
  -- Error messages are simply logged (see the code in the Container component).
 | 
			
		||||
  MessageReceived message _ -> do
 | 
			
		||||
    case message of
 | 
			
		||||
      AuthD.GotPasswordRecovered _ -> do
 | 
			
		||||
        handleAction $ ChangeTab Auth
 | 
			
		||||
      AuthD.GotPasswordRecoverySent _ -> do
 | 
			
		||||
        handleAction $ ChangeTab Recovery
 | 
			
		||||
      _ -> do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue