Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine;
using UnityEditor;

Expand Down Expand Up @@ -26,6 +26,7 @@ class AuthenticationView : Subview
[NonSerialized] private bool need2fa;
[NonSerialized] private bool busy;
[NonSerialized] private string message;
[NonSerialized] private bool enterPressed;

[NonSerialized] private AuthenticationService authenticationService;
private AuthenticationService AuthenticationService
Expand Down Expand Up @@ -73,6 +74,8 @@ public override void OnHide()

public override void OnGUI()
{
HandleEnterPressed();

scroll = GUILayout.BeginScrollView(scroll);
{
Rect authHeader = EditorGUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
Expand Down Expand Up @@ -116,6 +119,16 @@ public override void OnGUI()
GUILayout.EndScrollView();
}

private void HandleEnterPressed()
{
if (Event.current.type != EventType.KeyDown)
return;

enterPressed = Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter;
if (enterPressed)
Event.current.Use();
}

private void OnGUILogin()
{
GUILayout.Space(3);
Expand All @@ -142,7 +155,7 @@ private void OnGUILogin()
if (busy) GUI.enabled = false;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button(loginButton))
if (GUILayout.Button(loginButton) || (GUI.enabled && enterPressed))
{
GUI.FocusControl(null);
busy = true;
Expand Down Expand Up @@ -185,7 +198,7 @@ private void OnGUI2FA()

GUILayout.Space(Styles.BaseSpacing);

if (GUILayout.Button(twofaButton))
if (GUILayout.Button(twofaButton) || (GUI.enabled && enterPressed))
{
GUI.FocusControl(null);
busy = true;
Expand Down