Fix name
This commit is contained in:
parent
444fff5b62
commit
afc555e66e
2 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,7 @@ import "dart:convert";
|
|||
import "package:dart_jsonwebtoken/dart_jsonwebtoken.dart";
|
||||
import "package:matrixoidc/controllers/auth_code_controller.dart";
|
||||
import "package:matrixoidc/controllers/settings_controller.dart";
|
||||
import "package:matrixoidc/helpers/name_helper.dart";
|
||||
import "package:shelf/shelf.dart";
|
||||
import "package:http/http.dart" as http;
|
||||
import "package:matrixoidc/models/matrix_user.dart";
|
||||
|
@ -111,7 +112,7 @@ class ApiHelper {
|
|||
|
||||
final user = codes[code]!;
|
||||
ref.read(AuthCodeController.provider.notifier).remove(code);
|
||||
final name = user.userId.split(":").first.replaceFirst("@", "");
|
||||
final name = user.userId.getName();
|
||||
|
||||
final jwt = JWT(
|
||||
{
|
||||
|
@ -193,7 +194,7 @@ class ApiHelper {
|
|||
),
|
||||
);
|
||||
|
||||
final name = jwt.issuer!.split(":").first.replaceFirst("@", "");
|
||||
final name = jwt.subject!.getName();
|
||||
|
||||
return Response.ok(
|
||||
json.encode({
|
||||
|
|
3
lib/helpers/name_helper.dart
Normal file
3
lib/helpers/name_helper.dart
Normal file
|
@ -0,0 +1,3 @@
|
|||
extension GetName on String {
|
||||
String getName() => split(":")[1].replaceFirst("@", "");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue