In the Admin login form, I would like to completely disable Forgot password (removing the button). I only need to login.
Is there a way?
Thank you
I donāt think there is a way currently. You could submit a feature request on GitHub for Admin plugin
I think you can do this by making a simple modification to your theme. Copy the partials/login.html.twig
file from the email plugin to the partials folder of your theme.
In this file you have some lines referring to forgot your password. Delete them. In following code block is in which you will have to make your changes.
<div class="{{ form_button_outer_classes ?: 'form-actions secondary-accent' }}">
{% if config.plugins.login.rememberme.enabled and form.login.rememberme ?? true %}
<div class="form-data rememberme" data-grav-default="null" data-grav-disabled="true" data-grav-field="checkbox">
<div class="form-input-wrapper">
<input type="checkbox" value="1" name="rememberme" id="#rememberme">
<label class="inline" for="#rememberme" title="{{ 'PLUGIN_LOGIN.REMEMBER_ME_HELP'|t }}">{{ 'PLUGIN_LOGIN.REMEMBER_ME'|t }}</label>
</div>
</div>
{% endif %}
{% set forgot_button = form.login.forgot_button ?? true %}
{% set forgot_route = grav.login.getRoute('forgot') %}
{% if forgot_button and forgot_route %}
<a class="{{ form_button_classes ?: 'button secondary' }}" href="{{ base_url_relative ~ forgot_route }}"><i class="fa fa-exclamation-circle"></i> {{ 'PLUGIN_LOGIN.BTN_FORGOT'|t }}</a>
{% endif %}
<button class="{{ form_button_classes ?: 'button primary' }}" type="submit" name="task" value="login.login"><i class="fa fa-sign-in"></i> {{ 'PLUGIN_LOGIN.BTN_LOGIN'|t }}</button>
</div>
You will also have to disable the forgot route option in the plugin settings, for example pointing to the same route as the login or leaving blank (to prevent them from writing the default path in the browser)
I just realized that you might be referring to the admin panel login. Is that correct?
The answer above is for the login form for registered users of your website, not for users who can access the admin panel.
In this case, the admin plugin has its own login.html.twig file, inside the pluginās Grav theme. But of course, if you modify that file and then there are updates, your changes will be deleted.
I need to see how to override that partial, because it has the same name as the login pluginās (login.html.twig)
Thank you @pmoreno. I was wondering if there was an option (perhaps undocumented).
I see you marked a solution, but is it though? As @pmoreno mentioned, that template change will be overwritten on the next admin update and you will see the button again.
Iām not sure if adding a template in your theme would work here (needs to be tested), because the file structure is different there.
I think this is a feature to be implemented in the admin plugin itself. Thatās why I suggested creating a feature request on the repo
I marked @pmoreno reply as solution because, at the moment, itās the only workaround possible.
I agree with you about implementing such a feature. IMHO it could be useful. Perhaps, not to everyone, but at least to someone For example, in my scenario, Iām the only user and I didnāt configure any mail service on my VPS (because usually I rely on external services like AWS SES, Mailgun, etc.).
I just uploaded a PR to the login plugin repository to add the option to enable or disable the Forgot button, but the login plugin is different, as I said, from the admin pluginās login form.
For the latter modification, there may also be some option that I will have to investigate.
Wanted to add a comment, but Pamtbaau beat me to it
Hi @pmoreno, thanks for your time.
I just added a comment to the PR you already closed.
IMHO such an option (for the admin login) would be useful, especially for non-developers and less technically skilled users.
Created a PR for Admin plugin