Skip to content

Commit

Permalink
YDA-5550: pam user error message
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox authored Nov 30, 2023
1 parent e43cb65 commit 4ac40a9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
12 changes: 12 additions & 0 deletions user/templates/user/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
{% block title %}{{ super() }} ‐ Sign in{% endblock title %}

{% block content %}
<div
id="alert-user-not-in-instance"
{% if alert_user_not_in_instance is defined and alert_user_not_in_instance %}
class="alert alert-danger alert-dismissible fade show"
{% else %}
class="alert alert-danger alert-dismissible fade hidden"
{% endif %}
role="alert">
Your user is not part of this Yoda instance (yet).
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

<div class="row">
<div class="offset-md-2 col-md-8">
<div class="card">
Expand Down
21 changes: 20 additions & 1 deletion user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@

import jwt
import requests
from flask import Blueprint, current_app as app, flash, g, redirect, render_template, request, Response, session, url_for
from flask import (
Blueprint,
current_app as app,
flash,
g,
redirect,
render_template,
request,
Response,
session,
url_for
)
from irods.exception import CAT_INVALID_AUTHENTICATION, CAT_INVALID_USER, iRODSException, PAM_AUTH_PASSWORD_FAILED
from irods.session import iRODSSession

Expand Down Expand Up @@ -93,6 +104,14 @@ def login() -> Response:
log_error("iRODS authentication failed for user " + username)
return render_template('user/login.html', login_placeholder=get_login_placeholder())

except CAT_INVALID_USER:
log_error("iRODSException CAT_INVALID_USER for login of user " + str(username), True)
return render_template(
'user/login.html',
login_placeholder=get_login_placeholder(),
alert_user_not_in_instance=True
)

except iRODSException:
flash(
'An error occurred while connecting to iRODS. '
Expand Down
2 changes: 1 addition & 1 deletion vault/static/vault/js/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ function topInformation (dir, showAlert) {
{ quiet: true, rawResult: true }).then((dataRaw) => {
const data = dataRaw.data
if (dataRaw.status === 'error_nonexistent') {
Yoda.set_message('error', 'This vault space path does not exists: ' + dir)
Yoda.set_message('error', 'This vault space path does not exist: ' + dir)
$('#file-browser_wrapper').addClass('hide')
$('.top-information').addClass('hide')

Expand Down

0 comments on commit 4ac40a9

Please sign in to comment.