chore: Make error text on email orange and set displayname

This commit is contained in:
Christian Pauly 2022-06-02 09:54:38 +02:00
commit e5c29eedfe
3 changed files with 17 additions and 3 deletions

View file

@ -97,14 +97,24 @@ class SignupPageController extends State<SignupPage> {
);
}
final displayname = Matrix.of(context).loginUsername!;
final localPart = displayname.toLowerCase().replaceAll(' ', '_');
await client.uiaRequestBackground(
(auth) => client.register(
username: Matrix.of(context).loginUsername!,
username: localPart,
password: passwordController.text,
initialDeviceDisplayName: PlatformInfos.clientName,
auth: auth,
),
);
// Set displayname
if (displayname != localPart) {
await client.setDisplayName(
client.userID!,
displayname,
);
}
} catch (e) {
error = (e).toLocalizedString(context);
} finally {

View file

@ -94,6 +94,9 @@ class SignupPageView extends StatelessWidget {
),
hintText: L10n.of(context)!.enterAnEmailAddress,
errorText: controller.error,
errorColor: controller.emailController.text.isEmpty
? Colors.orangeAccent
: null,
),
),
),