CryoSPARC v4 - invalid email address for admin user

Hi,

After updating to 4.0 we cannot log in anymore to cryoSPARC’s WebApp with the admin user because its email address is treated as invalid. Our cryoSPARC’s admin accounts are set with the local email address of the user that runs the cryoSPARC instance (for ex. username@localhost).

Can you fix the JS/HTML email validation for for supporting @localhost email addresses?

Thanks,
Rafael.

Hi @rnavaza,

Thanks for reporting. Is it possible if you can use a standard email address (maybe the one provided by the institution?) or even the same email address but with any TLD “.com”?
To change the email address, you’re going to need to use the CryoSPARC icli:
To start the interactive Python shell, run cryosparcm icli in a shell on the master node, then:

user = cli.get_id_by_email('username@localhost')
db.users.update_one({'_id':user}, {'$set': {'emails.0.address':'username@localhost.dev'}})

Thanks @stephan,

As suggested I’ve added a dummy TLD to the email; now it works.

Cheers,
Rafael.

Heres a script to do this for all users in the instance that don’t already have a TLD:
Note that this script assumes that an “incorrect” email is incorrect because it’s missing a TLD (.com)

import re
valid_email_regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
all_users = db.users.find({}, {'_id':1, 'emails':1})
for user in all_users:
    user_email = user['emails'][0]['address']
    if not re.fullmatch(valid_email_regex, user_email):
        print(f'Invalid user email: {user_email}, adding TLD')
        db.users.update_one({'_id': user['_id']}, {'$set': {'emails.0.address': f'{user_email}.com'}})
    else:
        print(f'Valid user email: {user_email}')
1 Like