Redirect to 2FA creation page when otp_secret is not available (#6314)
This commit is contained in:
		
					parent
					
						
							
								31d1485887
							
						
					
				
			
			
				commit
				
					
						112b1fa265
					
				
			
		
					 3 changed files with 13 additions and 1 deletions
				
			
		|  | @ -6,6 +6,7 @@ module Settings | |||
|       layout 'admin' | ||||
| 
 | ||||
|       before_action :authenticate_user! | ||||
|       before_action :ensure_otp_secret | ||||
| 
 | ||||
|       def new | ||||
|         prepare_two_factor_form | ||||
|  | @ -38,6 +39,10 @@ module Settings | |||
|         @provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Rails.configuration.x.local_domain) | ||||
|         @qrcode = RQRCode::QRCode.new(@provision_url) | ||||
|       end | ||||
| 
 | ||||
|       def ensure_otp_secret | ||||
|         redirect_to settings_two_factor_authentication_path unless current_user.otp_secret | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue