feat: New change password page with server capabilities check
This commit is contained in:
parent
3eaecf0783
commit
5847fe0546
7 changed files with 296 additions and 94 deletions
|
|
@ -9,10 +9,16 @@ import 'package:matrix/matrix.dart';
|
|||
import 'uia_request_manager.dart';
|
||||
|
||||
extension LocalizedExceptionExtension on Object {
|
||||
String toLocalizedString(BuildContext context) {
|
||||
String toLocalizedString(
|
||||
BuildContext context, [
|
||||
ExceptionContext? exceptionContext,
|
||||
]) {
|
||||
if (this is MatrixException) {
|
||||
switch ((this as MatrixException).error) {
|
||||
case MatrixError.M_FORBIDDEN:
|
||||
if (exceptionContext == ExceptionContext.changePassword) {
|
||||
return L10n.of(context)!.passwordIsWrong;
|
||||
}
|
||||
return L10n.of(context)!.noPermission;
|
||||
case MatrixError.M_LIMIT_EXCEEDED:
|
||||
return L10n.of(context)!.tooManyRequestsWarning;
|
||||
|
|
@ -70,3 +76,7 @@ extension LocalizedExceptionExtension on Object {
|
|||
return L10n.of(context)!.oopsSomethingWentWrong;
|
||||
}
|
||||
}
|
||||
|
||||
enum ExceptionContext {
|
||||
changePassword,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue