Unverified Commit 508dac38 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Login page: Return HTTP 401; support JSON requests

parent f5091f10
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -3118,10 +3118,17 @@ sub startup {
			if ( $self->is_user_authenticated ) {
				return 1;
			}
			$self->render(
				'login',
			$self->respond_to(
				json => {
					json   => { error => 'authentication required' },
					status => 401
				},
				any => {
					template    => 'login',
					status      => 401,
					redirect_to => $self->req->url,
					from        => 'auth_required'
				}
			);
			return undef;
		}