From 76149acb7812bd337b6adf9ad6b020cdb8ec8c01 Mon Sep 17 00:00:00 2001 From: Marcus Funch Date: Thu, 25 Sep 2025 20:33:07 +0200 Subject: [PATCH] Login screen: Go back to using field_input and field_password, add sign in text --- mod/lostpass.php | 21 +++-- src/Module/Bookmarklet.php | 8 +- src/Module/Register.php | 2 +- src/Module/Security/Login.php | 4 +- view/lang/C/messages.po | 98 ++++++++++---------- view/templates/field_input.tpl | 6 +- view/templates/field_password.tpl | 6 +- view/templates/login.tpl | 6 +- view/templates/lostpass.tpl | 5 +- view/theme/frio/css/style.css | 41 ++++++-- view/theme/frio/scheme/light.php | 15 +-- view/theme/frio/style.php | 34 ++++--- view/theme/frio/templates/field_input.tpl | 2 +- view/theme/frio/templates/field_password.tpl | 6 +- view/theme/frio/templates/login.tpl | 23 +---- view/theme/frio/templates/nav.tpl | 4 +- 16 files changed, 153 insertions(+), 128 deletions(-) diff --git a/mod/lostpass.php b/mod/lostpass.php index d62fd5f5aa..39c1e14a81 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -1,4 +1,5 @@ addNotice(DI::l10n()->t('No valid account found.')); DI::baseUrl()->redirect(); @@ -31,7 +32,7 @@ function lostpass_post() $pwdreset_token = Strings::getRandomHex(32); $fields = [ - 'pwdreset' => hash('sha256', $pwdreset_token), + 'pwdreset' => hash('sha256', $pwdreset_token), 'pwdreset_time' => DateTimeFormat::utcNow() ]; $result = DBA::update('user', $fields, ['uid' => $user['uid']]); @@ -39,7 +40,7 @@ function lostpass_post() DI::sysmsg()->addInfo(DI::l10n()->t('Password reset request issued. Check your email.')); } - $sitename = DI::config()->get('config', 'sitename'); + $sitename = DI::config()->get('config', 'sitename'); $resetlink = DI::baseUrl() . '/lostpass/' . $pwdreset_token; $preamble = Strings::deindent(DI::l10n()->t(' @@ -92,7 +93,7 @@ function lostpass_content() // Password reset requests expire in 60 minutes if ($user['pwdreset_time'] < DateTimeFormat::utc('now - 1 hour')) { $fields = [ - 'pwdreset' => null, + 'pwdreset' => null, 'pwdreset_time' => null ]; DBA::update('user', $fields, ['uid' => $user['uid']]); @@ -111,11 +112,11 @@ function lostpass_content() function lostpass_form() { $tpl = Renderer::getMarkupTemplate('lostpass.tpl'); - $o = Renderer::replaceMacros($tpl, [ - '$title' => DI::l10n()->t('Forgot your Password?'), - '$desc' => DI::l10n()->t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), - '$name' => DI::l10n()->t('Nickname or Email: '), - '$submit' => DI::l10n()->t('Reset') + $o = Renderer::replaceMacros($tpl, [ + '$title' => DI::l10n()->t('Forgot your Password?'), + '$desc' => DI::l10n()->t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), + '$name' => DI::l10n()->t('Nickname or email'), + '$submit' => DI::l10n()->t('Reset my password') ]); return $o; @@ -126,7 +127,7 @@ function lostpass_generate_password($user) $o = ''; $new_password = User::generateNewPassword(); - $result = User::updatePassword($user['uid'], $new_password); + $result = User::updatePassword($user['uid'], $new_password); if (DBA::isResult($result)) { $tpl = Renderer::getMarkupTemplate('pwdreset.tpl'); $o .= Renderer::replaceMacros($tpl, [ diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php index d33a4b3a62..911a5f401c 100644 --- a/src/Module/Bookmarklet.php +++ b/src/Module/Bookmarklet.php @@ -27,13 +27,13 @@ class Bookmarklet extends BaseModule $config = DI::config(); if (!DI::userSession()->getLocalUserId()) { - $output = '

' . DI::l10n()->t('Login') . '

'; + $output = '

' . DI::l10n()->t('Sign in') . '

'; $output .= Login::form(DI::args()->getQueryString(), Register::getPolicy() !== Register::CLOSED); return $output; } $referer = Strings::normaliseLink($_SERVER['HTTP_REFERER'] ?? ''); - $page = Strings::normaliseLink(DI::baseUrl() . "/bookmarklet"); + $page = Strings::normaliseLink(DI::baseUrl() . "/bookmarklet"); if (!strstr($referer, $page)) { if (empty($_REQUEST["url"])) { @@ -43,8 +43,8 @@ class Bookmarklet extends BaseModule $content = "\n" . PageInfo::getFooterFromUrl($_REQUEST['url']); $x = [ - 'title' => trim($_REQUEST['title'] ?? '', '*'), - 'content' => $content + 'title' => trim($_REQUEST['title'] ?? '', '*'), + 'content' => $content ]; $output = DI::conversation()->statusEditor($x, 0, false); $output .= ""; diff --git a/src/Module/Register.php b/src/Module/Register.php index 7097d07c9f..48c4e6b6e8 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -154,7 +154,7 @@ class Register extends BaseModule '$invite_desc' => DI::l10n()->t('Membership on this site is by invitation only.'), '$invite_label' => DI::l10n()->t('Your invitation code: '), '$invite_id' => $invite_id, - '$regtitle' => DI::l10n()->t('Registration'), + '$regtitle' => DI::l10n()->t('Create an account'), '$registertext' => BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('config', 'register_text', '')), '$fillwith' => $fillwith, '$fillext' => $fillext, diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php index c0b5412d66..7bfb1ecb34 100644 --- a/src/Module/Security/Login.php +++ b/src/Module/Security/Login.php @@ -164,8 +164,8 @@ class Login extends BaseModule '$login' => DI::l10n()->t('Sign in'), '$new' => DI::l10n()->t('New here?'), - '$lname' => ['username', DI::l10n()->t('Nickname or email'), '', $username_desc], - '$lpassword' => ['password', DI::l10n()->t('Password'), '', ''], + '$lname' => ['username', DI::l10n()->t('Nickname or email'), '', $username_desc, '', 'autofocus', '', DI::l10n()->t('Nickname or email')], + '$lpassword' => ['password', DI::l10n()->t('Password'), '', '', '', '', '', DI::l10n()->t('Password')], '$lremember' => ['remember', DI::l10n()->t('Remember me'), 0, ''], '$openid' => !$noid, diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index b00509884d..7e3f833ce7 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2025.07-rc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-03 20:38+0200\n" +"POT-Creation-Date: 2025-10-05 14:42+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -82,15 +82,15 @@ msgstr "" msgid "Permission denied." msgstr "" -#: mod/lostpass.php:27 +#: mod/lostpass.php:28 msgid "No valid account found." msgstr "" -#: mod/lostpass.php:39 +#: mod/lostpass.php:40 msgid "Password reset request issued. Check your email." msgstr "" -#: mod/lostpass.php:45 +#: mod/lostpass.php:46 #, php-format msgid "" "\n" @@ -106,7 +106,7 @@ msgid "" "\t\tissued this request." msgstr "" -#: mod/lostpass.php:56 +#: mod/lostpass.php:57 #, php-format msgid "" "\n" @@ -123,64 +123,64 @@ msgid "" "\t\tLogin Name:\t%3$s" msgstr "" -#: mod/lostpass.php:71 +#: mod/lostpass.php:72 #, php-format msgid "Password reset requested at %s" msgstr "" -#: mod/lostpass.php:87 +#: mod/lostpass.php:88 msgid "Request could not be verified. (You may have previously submitted it.) Password reset failed." msgstr "" -#: mod/lostpass.php:100 +#: mod/lostpass.php:101 msgid "Request has expired, please make a new one." msgstr "" -#: mod/lostpass.php:115 +#: mod/lostpass.php:116 msgid "Forgot your Password?" msgstr "" -#: mod/lostpass.php:116 +#: mod/lostpass.php:117 msgid "Enter your email address and submit to have your password reset. Then check your email for further instructions." msgstr "" -#: mod/lostpass.php:117 src/Module/Security/Login.php:165 -msgid "Nickname or Email: " +#: mod/lostpass.php:118 src/Module/Security/Login.php:167 +msgid "Nickname or email" msgstr "" -#: mod/lostpass.php:118 -msgid "Reset" +#: mod/lostpass.php:119 +msgid "Reset my password" msgstr "" -#: mod/lostpass.php:133 src/Module/Security/Login.php:177 +#: mod/lostpass.php:134 src/Module/Security/Login.php:179 msgid "Password Reset" msgstr "" -#: mod/lostpass.php:134 +#: mod/lostpass.php:135 msgid "Your password has been reset as requested." msgstr "" -#: mod/lostpass.php:135 +#: mod/lostpass.php:136 msgid "Your new password is" msgstr "" -#: mod/lostpass.php:136 +#: mod/lostpass.php:137 msgid "Save or copy your new password - and then" msgstr "" -#: mod/lostpass.php:137 +#: mod/lostpass.php:138 msgid "click here to login" msgstr "" -#: mod/lostpass.php:138 +#: mod/lostpass.php:139 msgid "Your password may be changed from the Settings page after successful login." msgstr "" -#: mod/lostpass.php:142 +#: mod/lostpass.php:143 msgid "Your password has been reset." msgstr "" -#: mod/lostpass.php:145 +#: mod/lostpass.php:146 #, php-format msgid "" "\n" @@ -191,7 +191,7 @@ msgid "" "\t\t" msgstr "" -#: mod/lostpass.php:151 +#: mod/lostpass.php:152 #, php-format msgid "" "\n" @@ -205,7 +205,7 @@ msgid "" "\t\t" msgstr "" -#: mod/lostpass.php:163 +#: mod/lostpass.php:164 #, php-format msgid "Your password has been changed at %s" msgstr "" @@ -1970,8 +1970,9 @@ msgstr "" msgid "Search: @name, !group, #tags, content" msgstr "" -#: src/Content/Nav.php:220 src/Module/Security/Login.php:162 -msgid "Logout" +#: src/Content/Nav.php:220 src/Module/Security/Login.php:163 +#: src/Module/Security/TwoFactor/SignOut.php:105 +msgid "Sign out" msgstr "" #: src/Content/Nav.php:220 @@ -1979,11 +1980,7 @@ msgid "End this session" msgstr "" #: src/Content/Nav.php:222 src/Module/Bookmarklet.php:30 -#: src/Module/Security/Login.php:163 -msgid "Login" -msgstr "" - -#: src/Content/Nav.php:222 +#: src/Module/Security/Login.php:164 msgid "Sign in" msgstr "" @@ -2055,7 +2052,8 @@ msgstr "" msgid "Register" msgstr "" -#: src/Content/Nav.php:253 +#: src/Content/Nav.php:253 src/Module/Register.php:157 +#: src/Module/Security/Login.php:127 msgid "Create an account" msgstr "" @@ -4372,7 +4370,7 @@ msgstr "" msgid "Republish users to directory" msgstr "" -#: src/Module/Admin/Site.php:447 src/Module/Register.php:157 +#: src/Module/Admin/Site.php:447 msgid "Registration" msgstr "" @@ -8753,10 +8751,6 @@ msgstr "" msgid "Search term was not removed." msgstr "" -#: src/Module/Security/Login.php:127 -msgid "Create a New Account" -msgstr "" - #: src/Module/Security/Login.php:146 msgid "Your OpenID: " msgstr "" @@ -8766,34 +8760,42 @@ msgid "Please enter your username and password to add the OpenID to your existin msgstr "" #: src/Module/Security/Login.php:151 -msgid "Or login using OpenID: " +msgid "Or sign in using OpenID" msgstr "" -#: src/Module/Security/Login.php:166 -msgid "Password: " +#: src/Module/Security/Login.php:156 +msgid "OpenID" msgstr "" -#: src/Module/Security/Login.php:167 +#: src/Module/Security/Login.php:165 +msgid "New here?" +msgstr "" + +#: src/Module/Security/Login.php:168 +msgid "Password" +msgstr "" + +#: src/Module/Security/Login.php:169 msgid "Remember me" msgstr "" -#: src/Module/Security/Login.php:176 +#: src/Module/Security/Login.php:178 msgid "Forgot your password?" msgstr "" -#: src/Module/Security/Login.php:179 +#: src/Module/Security/Login.php:181 msgid "Website Terms of Service" msgstr "" -#: src/Module/Security/Login.php:180 +#: src/Module/Security/Login.php:182 msgid "terms of service" msgstr "" -#: src/Module/Security/Login.php:182 +#: src/Module/Security/Login.php:184 msgid "Website Privacy Policy" msgstr "" -#: src/Module/Security/Login.php:183 +#: src/Module/Security/Login.php:185 msgid "privacy policy" msgstr "" @@ -8895,10 +8897,6 @@ msgstr "" msgid "

If you trust this browser, you will not be asked for verification code the next time you sign in.

" msgstr "" -#: src/Module/Security/TwoFactor/SignOut.php:105 -msgid "Sign out" -msgstr "" - #: src/Module/Security/TwoFactor/SignOut.php:107 msgid "Trust and sign out" msgstr "" diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index 21c7a8f067..22cbfcbd20 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -6,8 +6,10 @@ *}}
- - + {{if $label != false}} + + {{/if}} + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/templates/field_password.tpl b/view/templates/field_password.tpl index 645d3617ea..9852dc0306 100644 --- a/view/templates/field_password.tpl +++ b/view/templates/field_password.tpl @@ -5,8 +5,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later *}}
- - + {{if $label != false}} + + {{/if}} + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/templates/login.tpl b/view/templates/login.tpl index 0dd15bb993..7e85e1c091 100644 --- a/view/templates/login.tpl +++ b/view/templates/login.tpl @@ -25,7 +25,7 @@ {{$lostlink}}
- + {{if $openid}}
{{include file="field_openid.tpl" field=$lopenid}} @@ -37,11 +37,11 @@
{{include file="field_checkbox.tpl" field=$lremember}} - + {{foreach $hiddens as $k=>$v}} {{/foreach}} - + diff --git a/view/templates/lostpass.tpl b/view/templates/lostpass.tpl index df7f261d1d..35c95b7486 100644 --- a/view/templates/lostpass.tpl +++ b/view/templates/lostpass.tpl @@ -13,12 +13,11 @@
- - +
- +
diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index dd4e8ab0b4..5e2ff2f748 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -536,6 +536,7 @@ header #banner #logo-img, .topbar ul.nav > li { float: left; } + @media (min-width: 992px) { .topbar ul.nav > li > a, .topbar ul.nav > li > button { @@ -2604,6 +2605,16 @@ body.mod-home .navbar #nav-login, body.mod-login .navbar #nav-login { display: none; } + +.mod-lostpass #content { + margin-top: 0!important; + width: 650px; +} + +.mod-lostpass #login-name-wrapper{ + margin: 20px 0; +} + /* Profile-page */ #profile-content-standard, #profile-content-advanced { @@ -3700,8 +3711,22 @@ section .profile-match-wrapper { } /** - * Login page + * Home / Login page */ + +#openid-header, #new-here { + padding-top: 15px; +} +.mod-home .row { + margin: 0; +} +.mod-home #content { + padding: 0; +} +div.login-form, .login-content-wrapper { + margin: 20px 0; + padding: 10px 15px; +} #lost-password-link { flex-grow: 2; } @@ -3721,15 +3746,19 @@ section .profile-match-wrapper { text-align: center; } #register-link { - color: white; background: #5aa071; margin-bottom: 10px; width: 75%; } +div.login-form, .login-content-wrapper, .mod-home.is-not-singleuser, .mod-login { background-color: $login_bg_color; +} + +.mod-home.is-not-singleuser, +.mod-login { background-image: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.4)), url($login_bg_image); background-size: cover; background-attachment: fixed; @@ -3749,13 +3778,13 @@ section .profile-match-wrapper { } .mod-home.is-not-singleuser .login-content, .mod-login .login-content { - color: #eee; margin-top: 2.5%; } -.mod-home.is-not-singleuser .login-form > #login-form label, -.mod-login #content #login-form label { - color: #eee; +.mod-home.is-not-singleuser .login-content, +.mod-login .login-content, +#register-link { + color: white; } .mod-home.is-not-singleuser .login-panel-content, diff --git a/view/theme/frio/scheme/light.php b/view/theme/frio/scheme/light.php index 51d630a46e..15166e98fe 100644 --- a/view/theme/frio/scheme/light.php +++ b/view/theme/frio/scheme/light.php @@ -1,4 +1,5 @@ darken(10); +$nav_bg = '#' . $accentColor->darken(10); $menu_background_hover_color = '#' . $accentColor->darken(5); -$nav_icon_color = "#fff"; -$link_color = '#' . $accentColor->getHex(); -$background_color = "#ededed"; -$login_bg_color = "#ededed"; -$contentbg_transp = 100; -$background_image = ''; +$nav_icon_color = "#fff"; +$link_color = '#' . $accentColor->getHex(); +$background_color = "#ededed"; +$login_bg_color = "#fff"; +$contentbg_transp = 100; +$background_image = ''; diff --git a/view/theme/frio/style.php b/view/theme/frio/style.php index 5e9c0478e1..9901f8e061 100644 --- a/view/theme/frio/style.php +++ b/view/theme/frio/style.php @@ -1,4 +1,5 @@ has(\Friendica\App\Mode::MAINTENANCEDISABLED)) { if (!$login_bg_image && !$login_bg_color) { $login_bg_image = 'img/login_bg.jpg'; } -$login_bg_color = $login_bg_color ?: '#ededed'; +$login_bg_color = $login_bg_color ?: '#fff'; $scheme = Strings::sanitizeFilePathItem($scheme); @@ -94,14 +95,14 @@ $contentbg_transp = $contentbg_transp != '' ? $contentbg_transp : 100; // Some colors are calculated to don't have too many selection // fields in the theme settings. if (!isset($menu_background_hover_color)) { - $mbhc = new Color($nav_bg); + $mbhc = new Color($nav_bg); $mcolor = $mbhc->getHex(); if ($mbhc->isLight($mcolor, 75)) { - $menu_is = 'light'; + $menu_is = 'light'; $menu_background_hover_color = '#' . $mbhc->darken(5); } else { - $menu_is = 'dark'; + $menu_is = 'dark'; $menu_background_hover_color = '#' . $mbhc->lighten(5); } } @@ -115,7 +116,7 @@ if (!isset($nav_icon_hover_color)) { } } if (!isset($link_hover_color)) { - $lhc = new Color($link_color); + $lhc = new Color($link_color); $lcolor = $lhc->getHex(); if ($lhc->isLight($lcolor, 75)) { @@ -133,24 +134,24 @@ if (!isset($bg_image_option)) { switch ($bg_image_option) { case 'stretch': $background_size_img = '100%'; - $background_repeat = 'no-repeat'; + $background_repeat = 'no-repeat'; break; case 'cover': $background_size_img = 'cover'; - $background_repeat = 'no-repeat'; + $background_repeat = 'no-repeat'; break; case 'repeat': $background_size_img = 'auto'; - $background_repeat = 'repeat'; + $background_repeat = 'repeat'; break; case 'contain': $background_size_img = 'contain'; - $background_repeat = 'repeat'; + $background_repeat = 'repeat'; break; default: $background_size_img = 'auto'; - $background_repeat = 'no-repeat'; + $background_repeat = 'no-repeat'; break; } @@ -173,9 +174,9 @@ $options = [ '$background_repeat' => $background_repeat, '$login_bg_image' => $login_bg_image, '$login_bg_color' => $login_bg_color, - '$font_color_darker' => $font_color_darker ?? '#222', + '$font_color_darker' => $font_color_darker ?? '#222', '$font_color_lighter' => $font_color_lighter ?? '#aaa', - '$font_color' => $font_color ?? '#444', + '$font_color' => $font_color ?? '#444', ]; $css_tpl = file_get_contents('view/theme/frio/css/style.css'); @@ -208,8 +209,11 @@ header('Last-Modified: ' . $modified); /// @todo Check if this works at all (possibly clients are sending only the one or the other header) - compare with mod/photo.php if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])); - $cached_etag = str_replace(['"', '-gzip'], ['', ''], - stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); + $cached_etag = str_replace( + ['"', '-gzip'], + ['', ''], + stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) + ); if (($cached_modified == $modified) && ($cached_etag == $etag)) { throw new NotModifiedException(); diff --git a/view/theme/frio/templates/field_input.tpl b/view/theme/frio/templates/field_input.tpl index 9a62078ae6..265f6d5bae 100644 --- a/view/theme/frio/templates/field_input.tpl +++ b/view/theme/frio/templates/field_input.tpl @@ -9,7 +9,7 @@ {{if !isset($label) || $label != false }} {{/if}} - + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/theme/frio/templates/field_password.tpl b/view/theme/frio/templates/field_password.tpl index 720a0e452a..3909f99dbb 100644 --- a/view/theme/frio/templates/field_password.tpl +++ b/view/theme/frio/templates/field_password.tpl @@ -5,8 +5,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later *}}
- - + {{if $label != false }} + + {{/if}} + {{if $field.3}} {{$field.3 nofilter}} {{/if}} diff --git a/view/theme/frio/templates/login.tpl b/view/theme/frio/templates/login.tpl index 562cbe116c..bc8cf8908f 100644 --- a/view/theme/frio/templates/login.tpl +++ b/view/theme/frio/templates/login.tpl @@ -17,24 +17,11 @@

{{$login}}

- -
-
- - {{if $lname.3}} - {{$lname.3 nofilter}} - {{/if}} -
-
- - {{if $lpassword.3}} - {{$lpassword.3 nofilter}} - {{/if}} -
-
- + {{include file="field_input.tpl" field=$lname label=false}} + {{include file="field_password.tpl" field=$lpassword label=false}} +
+ {{if $openid}} diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index 0deae013ab..be3c66b720 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -488,9 +488,9 @@