Skip to content

Commit

Permalink
feat(authentication): show sign up redirect button in login screen
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Oct 2, 2024
1 parent 63f9cff commit 92b1b83
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- app:优化图片加载流程,加载更平滑。
- app:现在在头像加载失败时会使用本地默认的头像,避免头像一直空白。
- app:现在加载失败的头像更容易触发重新加载。
- 登录:在登录界面显示注册账户的跳转链接。

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions lib/constants/url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const baseUrl = 'https://www.tsdm39.com';
/// Homepage of tsdm.
const homePage = '$baseUrl/forum.php';

/// Page to register new account
const signUpPage = '$baseUrl/member.php?mod=register.php';

/// User profile page for user with given uid.
const uidProfilePage = '$baseUrl/home.php?mod=space&uid=';

Expand Down
27 changes: 18 additions & 9 deletions lib/features/authentication/widgets/login_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:tsdm_client/constants/layout.dart';
import 'package:tsdm_client/constants/url.dart';
import 'package:tsdm_client/extensions/build_context.dart';
import 'package:tsdm_client/features/authentication/bloc/authentication_bloc.dart';
import 'package:tsdm_client/features/authentication/repository/models/models.dart';
import 'package:tsdm_client/features/authentication/widgets/captcha_image.dart';
Expand Down Expand Up @@ -237,16 +239,23 @@ class _LoginFormState extends State<LoginForm> with LoggerMixin {
: tr.answerEmpty,
),
sizedBoxW12H12,
Row(
children: [
Expanded(
child: DebounceFilledButton(
shouldDebounce: pending,
onPressed: () async => _login(context, loginField, state),
child: Text(tr.login),
),
DebounceFilledButton(
shouldDebounce: pending,
onPressed: () async => _login(context, loginField, state),
child: Text(tr.login),
),
sizedBoxW12H12,
Center(
child: TextButton(
child: Text(
tr.signUpHint,
style: const TextStyle(decoration: TextDecoration.underline),
),
],
onPressed: () async => context.dispatchAsUrl(
signUpPage,
external: true,
),
),
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/strings.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"username": "Username",
"uid": "UID",
"email": "Email"
}
},
"signUpHint": "Do not have an account? Sign up here"
},
"rootPage": {
"initFailed": "Init failed: $err",
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/strings_zh-CN.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"username": "用户名",
"uid": "UID",
"email": "邮箱"
}
},
"signUpHint": "没有账号?点此注册"
},
"rootPage": {
"initFailed": "初始化失败: $err",
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/strings_zh-TW.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"username": "使用者名稱",
"uid": "UID",
"email": "信箱"
}
},
"signUpHint": "沒有帳號?點此註冊"
},
"rootPage": {
"initFailed": "初始化失敗: $err",
Expand Down

0 comments on commit 92b1b83

Please sign in to comment.