@@ -27,6 +27,8 @@ import Modal from "./Modal";
2727import { _t } from "./languageHandler" ;
2828import QuestionDialog from "./components/views/dialogs/QuestionDialog" ;
2929import { Action } from "./dispatcher/actions" ;
30+ import SettingsStore from "./settings/SettingsStore" ;
31+ import { UIFeature } from "./settings/UIFeature" ;
3032
3133// Regex for what a "safe" or "Matrix-looking" localpart would be.
3234// TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514
@@ -46,29 +48,32 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/;
4648 */
4749export async function startAnyRegistrationFlow (
4850 // eslint-disable-next-line camelcase
49- options : { go_home_on_cancel ?: boolean ; go_welcome_on_cancel ?: boolean ; screen_after ?: boolean } ,
51+ options : { go_home_on_cancel ?: boolean ; go_welcome_on_cancel ?: boolean ; screen_after ?: boolean } = { } ,
5052) : Promise < void > {
51- if ( options === undefined ) options = { } ;
5253 const modal = Modal . createDialog ( QuestionDialog , {
5354 hasCancelButton : true ,
5455 quitOnly : true ,
55- title : _t ( "Sign In or Create Account" ) ,
56- description : _t ( "Use your account or create a new one to continue." ) ,
57- button : _t ( "Create Account" ) ,
58- extraButtons : [
59- < button
60- key = "start_login"
61- onClick = { ( ) => {
62- modal . close ( ) ;
63- dis . dispatch ( { action : "start_login" , screenAfterLogin : options . screen_after } ) ;
64- } }
65- >
66- { _t ( "Sign In" ) }
67- </ button > ,
68- ] ,
56+ title : SettingsStore . getValue ( UIFeature . Registration ) ? _t ( "Sign In or Create Account" ) : _t ( "Sign In" ) ,
57+ description : SettingsStore . getValue ( UIFeature . Registration )
58+ ? _t ( "Use your account or create a new one to continue." )
59+ : _t ( "Use your account to continue." ) ,
60+ button : _t ( "Sign In" ) ,
61+ extraButtons : SettingsStore . getValue ( UIFeature . Registration )
62+ ? [
63+ < button
64+ key = "register"
65+ onClick = { ( ) => {
66+ modal . close ( ) ;
67+ dis . dispatch ( { action : "start_registration" , screenAfterLogin : options . screen_after } ) ;
68+ } }
69+ >
70+ { _t ( "Create Account" ) }
71+ </ button > ,
72+ ]
73+ : [ ] ,
6974 onFinished : ( proceed ) => {
7075 if ( proceed ) {
71- dis . dispatch ( { action : "start_registration " , screenAfterLogin : options . screen_after } ) ;
76+ dis . dispatch ( { action : "start_login " , screenAfterLogin : options . screen_after } ) ;
7277 } else if ( options . go_home_on_cancel ) {
7378 dis . dispatch ( { action : Action . ViewHomePage } ) ;
7479 } else if ( options . go_welcome_on_cancel ) {
0 commit comments