mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Added button for empty post login call
This commit is contained in:
@@ -38,6 +38,10 @@ export class AuthInterceptor implements HttpInterceptor {
|
||||
return response.status === 405;
|
||||
}
|
||||
|
||||
private is302Response(response: HttpResponseBase): boolean {
|
||||
return response.status === 302;
|
||||
}
|
||||
|
||||
private isUnauthorized(response: HttpResponseBase): boolean {
|
||||
// invalid_token The access token provided is expired, revoked, malformed, or invalid for other reasons
|
||||
return response.status === 401;
|
||||
@@ -131,7 +135,7 @@ export class AuthInterceptor implements HttpInterceptor {
|
||||
// It's a success Login/Logout response
|
||||
let authRes: HttpResponse<any>;
|
||||
if (this.isLoginResponse(response)) {
|
||||
console.log('auth.interceptor passes success login response from backend with token: ',response.headers.get('authorization') );
|
||||
console.log('auth.interceptor passes success login response from backend with token: ', response.headers.get('authorization'));
|
||||
// login successfully
|
||||
const newToken = response.headers.get('authorization');
|
||||
authRes = response.clone({body: this.makeAuthStatusObject(true, newToken)});
|
||||
|
@@ -34,6 +34,12 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div >
|
||||
<br>
|
||||
<a class="btn btn-lg btn-primary btn-block mt-2" (click)="postLoginCall()" role="button">Simple Post Login</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#">{{"login.form.new-user" | translate}}</a>
|
||||
|
@@ -206,4 +206,10 @@ export class LogInComponent implements OnDestroy, OnInit {
|
||||
// clear form
|
||||
this.form.reset();
|
||||
}
|
||||
|
||||
postLoginCall() {
|
||||
const email = '';
|
||||
const password = '';
|
||||
this.store.dispatch(new AuthenticateAction(email, password));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user