DSpace 7.6.1 - Remove "Have you Forgot your password?" or link somewhere else

85 views
Skip to first unread message

Tomas Hajek

unread,
Jan 23, 2024, 9:38:17 AM1/23/24
to DSpace Technical Support
Hi,
  I'm currently running DSpace version 7.6.1 and using LDAP authentication.  I'm wondering if there is a method of either removing the "Have you Forgot your password?" link or being able to change the link to point to another site. 
  I saw a related issue (https://github.com/DSpace/DSpace/issues/8293) but it looks like that is still on the "To Do" board for 7.6.x (https://github.com/orgs/DSpace/projects/29/views/1?filterQuery=8293).
  I've attempted using an Apache HTTPD rewrite rule to redirect /forgot to the password reset page that we want users to use but that only seems to work if the user goes directly to the /forgot URL.  I'm guessing that when a user clicks on the link under the "Login" drop-down that it is JavaScript doing the URL change so it doesn't actually hit the Apache HTTPD server in order to do a rewrite (although I could be doing it wrong).
  My next attempt might be to change the forgot-password-form Angular components in the theme but that might cause me other issues.
  Does anyone have any suggestions?
Thanks for your help!
 -Tomas
   

Matthias Letsch

unread,
Jan 23, 2024, 11:40:37 AM1/23/24
to DSpace Technical Support
Hi Tomas,

at least I can give you the location where this can be changed in the source code of the angular-frontend.

There is a component .../src/app/shared/log-in/methods/password/log-in-password.component.html that should look like this:

<form class="form-login" (ngSubmit)="submit()" [formGroup]="form" novalidate>
  <label class="sr-only">{{"login.form.email" | translate}}</label>
  <input [attr.aria-label]="'login.form.email' |translate" autocomplete="off" autofocus
    class="form-control form-control-lg position-relative" formControlName="email"
    placeholder="{{'login.form.email' | translate}}" required type="email" [attr.data-test]="'email' | dsBrowserOnly">
  <label class="sr-only">{{"login.form.password" | translate}}</label>
  <input [attr.aria-label]="'login.form.password' |translate" autocomplete="off"
    class="form-control form-control-lg position-relative mb-3" placeholder="{{'login.form.password' | translate}}"
    formControlName="password" required type="password" [attr.data-test]="'password' | dsBrowserOnly">
  <div *ngIf="(error | async) && hasError" class="alert alert-danger" role="alert" @fadeOut>{{ (error | async) |
    translate }}</div>
  <div *ngIf="(message | async) && hasMessage" class="alert alert-info" role="alert" @fadeOut>{{ (message | async) |
    translate }}</div>

  <button class="btn btn-lg btn-primary btn-block mt-3" type="submit" [attr.data-test]="'login-button' | dsBrowserOnly"
    [disabled]="!form.valid"><i class="fas fa-sign-in-alt"></i> {{"login.form.submit" | translate}}</button>
</form>

<div class="mt-2">
  <a class="dropdown-item" *ngIf="canRegister$ | async" [routerLink]="[getRegisterRoute()]"
    [attr.data-test]="'register' | dsBrowserOnly">
    {{ 'login.form.new-user' | translate }}
  </a>
  <a class="dropdown-item text-primary" [routerLink]="[getForgotRoute()]" [attr.data-test]="'forgot' | dsBrowserOnly">
    {{ 'login.form.forgot-password' | translate }}
  </a>
</div>

I assume that the ldap authentication method also uses this component, since there is no other component that uses the forgot password link.

Commenting out or deleting the last link in the html file ensures that the link is no longer displayed.

<a class="dropdown-item text-primary" [routerLink]="[getForgotRoute()]" [attr.data-test]="'forgot' | dsBrowserOnly">
    {{ 'login.form.forgot-password' | translate }}
  </a>

(You may want to copy the component into your own theme, but I have not tested whether further changes are then necessary.)

Kind regards,
Matthias

Tomas Hajek

unread,
Jan 23, 2024, 4:38:49 PM1/23/24
to DSpace Technical Support
Hi Matthias,
   Thanks for this information.  For the moment I wound up copying over src/themes/custom/app/forgot-password/ into my theme and modifying forgot-email.component.html to remove the form and just have some text with a link to our password reset page.  I might dig deeper into it like you suggested to remove the link completely but for now I think the solution I have might work ok.
  Thanks again for the response.  I learned something from it and really appreciated the quick response.
-Tomas

Reply all
Reply to author
Forward
0 new messages