Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

refact(oidc): icon azure to microsoft (#15278)

fufesou93d064a9b0eb
diff --git a/flutter/assets/auth-azure.svg b/flutter/assets/auth-azure.svg
deleted file mode 100644
index b7435604d..000000000
--- a/flutter/assets/auth-azure.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="256" height="199"><path fill="#0089d6" d="M118.432 187.698c32.89-5.81 60.055-10.618 60.367-10.684l.568-.12-31.052-36.935c-17.078-20.314-31.051-37.014-31.051-37.11 0-.182 32.063-88.477 32.243-88.792.06-.105 21.88 37.567 52.893 91.32 29.035 50.323 52.973 91.815 53.195 92.203l.405.707-98.684-.012-98.684-.013 59.8-10.564zM0 176.435c0-.052 14.631-25.451 32.514-56.442l32.514-56.347 37.891-31.799C123.76 14.358 140.867.027 140.935.001c.069-.026-.205.664-.609 1.534s-18.919 40.582-41.145 88.25l-40.41 86.67-29.386.037c-16.162.02-29.385-.005-29.385-.057z"/></svg>
\ No newline at end of file
diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart
index ee376de68..319171895 100644
--- a/flutter/lib/common/widgets/login.dart
+++ b/flutter/lib/common/widgets/login.dart
@@ -24,6 +24,35 @@ const kOpSvgList = [
'microsoft'
];
+class _OidcProviderBranding {
+ final String label;
+ final String iconKey;
+
+ const _OidcProviderBranding({
+ required this.label,
+ required this.iconKey,
+ });
+}
+
+_OidcProviderBranding _oidcProviderBranding(String op) {
+ switch (op.toLowerCase()) {
+ case 'azure':
+ return _OidcProviderBranding(
+ label: 'Microsoft',
+ iconKey: 'microsoft',
+ );
+ default:
+ return _OidcProviderBranding(
+ label: {
+ 'github': 'GitHub',
+ 'gitlab': 'GitLab',
+ }[op.toLowerCase()] ??
+ toCapitalized(op),
+ iconKey: op.toLowerCase(),
+ );
+ }
+}
+
class _IconOP extends StatelessWidget {
final String op;
final String? icon;
@@ -74,11 +103,8 @@ class ButtonOP extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final opLabel = {
- 'github': 'GitHub',
- 'gitlab': 'GitLab'
- }[op.toLowerCase()] ??
- toCapitalized(op);
+ final branding = _oidcProviderBranding(op);
+ final buttonLabel = translate("Continue with {${branding.label}}");
return Row(children: [
Container(
height: height,
@@ -95,7 +121,7 @@ class ButtonOP extends StatelessWidget {
SizedBox(
width: 30,
child: _IconOP(
- op: op,
+ op: branding.iconKey,
icon: icon,
margin: EdgeInsets.only(right: 5),
),
@@ -103,8 +129,7 @@ class ButtonOP extends StatelessWidget {
Expanded(
child: FittedBox(
fit: BoxFit.scaleDown,
- child: Center(
- child: Text(translate("Continue with {$opLabel}"))),
+ child: Center(child: Text(buttonLabel)),
),
),
],