1- # ###################################################################
21# ' Login Module for Shiny
32# '
43# ' Login Module for Shiny with local User and Password. This must be
@@ -76,9 +75,10 @@ module_login <- function(input, session,
7675
7776 # Rename values with custom texts
7877 if (length(change_text ) > 0 ) {
79- lares :: check_opts(names(change_text ), dic $ term )
8078 for (term in names(change_text )) {
81- dic $ text [dic $ term == term ] <- change_text [[term ]]
79+ if (term %in% dic $ term ) {
80+ dic $ text [dic $ term == term ] <- change_text [[term ]]
81+ }
8282 }
8383 }
8484
@@ -89,16 +89,30 @@ module_login <- function(input, session,
8989 " ; background-color:" , style $ botton_bgd_colour ,
9090 " ; border-radius: 6px;"
9191 )
92- modalDialog(if (! is.na(logo )) img(src = logo , height = logo_height , align = " center" ),
92+ modalDialog(
93+ if (! is.na(logo )) img(src = logo , height = logo_height , align = " center" ),
9394 title = dic $ text [dic $ term == " title" ],
9495 textInput(" username" , paste0(dic $ text [dic $ term == " user" ], " :" ), width = " 100%" ),
9596 passwordInput(" password" , paste0(dic $ text [dic $ term == " pass" ], " :" ), width = " 100%" ),
96- footer = tagList(actionButton(" ok" , HTML(paste0(
97- " <span>" , dic $ text [dic $ term == " enter" ],
98- ' </span> <span class="fa fa-chevron-right"></span>'
99- )),
100- style = button_style
101- )), size = " m"
97+ footer = tagList(
98+ actionButton(" ok" , HTML(paste0(
99+ " <span>" , dic $ text [dic $ term == " enter" ],
100+ ' </span> <span class="fa fa-chevron-right"></span>'
101+ )),
102+ style = button_style
103+ ),
104+ # Add JavaScript to handle Enter key
105+ tags $ script(HTML("
106+ $(document).on('keypress', function(e) {
107+ if(e.which == 13) {
108+ if($('#password').is(':focus')) {
109+ $('#ok').click();
110+ }
111+ }
112+ });
113+ " ))
114+ ),
115+ size = " m"
102116 )
103117 }
104118
0 commit comments