scudcloud icon indicating copy to clipboard operation
scudcloud copied to clipboard

Asked to re-authenticate every time the application starts

Open ghost opened this issue 11 years ago • 11 comments

Hi there,

I am asked to authenticate every single time I start the application. I do have ~/.config/scudcloud/scudcloud.cfg file. The domain is mentioned inside that file.

My company uses two-factors authentication, not sure whether that has anything to do with it.

Can this be fixed ?

Thank you.

ghost avatar Aug 07 '15 16:08 ghost

I am having the same issue, I also have ~/.config/scudcloud/scudcloud.cfg file. I am using Linux Mint and the PPA version, and we do NOT have two-factors authentication.

devng avatar Aug 11 '15 08:08 devng

Same issue here on ElementaryOS, running the latest version.

mahammedzkhan avatar Aug 14 '15 07:08 mahammedzkhan

OK, I think i found a workaround. For me I had to close ScudCloud by hand one time and then after restart the auto login works. So my assumption is that the application does not intercept a shot down signal properly and it does not persist the cookie in that case, but when you close it properly it does save the cookie and it is available after restart.

devng avatar Aug 20 '15 11:08 devng

You are right, I signed to all my slack groups, delete config file and close/quit. then when launch scudcloud it have all my groups and my sessions active.

RoverWire avatar Aug 28 '15 18:08 RoverWire

Interesting and nice feedback, guys. In theory, a Qt application should be normally closed during system shutdown. I'll investigate to see if I can try to intercept this and properly close the app.

raelgc avatar Sep 02 '15 19:09 raelgc

Can confirm that @devng's suggestion worked for me. Closing Scudcloud once via the File > Quit menu seems to have persisted my login sessions. I didn't have to delete any config files.

tristang avatar Sep 03 '15 04:09 tristang

@raelgc why not just persist the cookie after successful login and not when the app quits.

devng avatar Sep 03 '15 07:09 devng

Guys, can you try, using root or sudo, replace the file located at /opt/scudcloud/scudcloud with the below content and check if data will be persisted after system shutdown?

I added a handler for SIGINT.

#!/usr/bin/env python3
import os, sys, signal
from PyQt4 import QtGui

# Flexible install dir (we assume that 'lib' and 'resources' will be subdirs)
INSTALL_DIR = os.path.dirname(os.path.realpath(__file__))

# Append the lib directory in our installation path to get remaining libraries.
sys.path.append(os.path.join(INSTALL_DIR, 'lib'))
from resources import Resources
from scudcloud import ScudCloud
from qsingleapplication import QSingleApplication

# The ScudCloud QMainWindow
win = None

def main():
    global win;
    Resources.INSTALL_DIR = INSTALL_DIR
    signal.signal(signal.SIGINT, exit)
    app = QSingleApplication(sys.argv)
    app.setApplicationName(Resources.APP_NAME)
    app.setWindowIcon(QtGui.QIcon(Resources.get_path('scudcloud.png')))
    args = parse_arguments()
    ScudCloud.debug = args.debug
    ScudCloud.minimized = True if args.minimized is True else None
    ScudCloud.plugins = False if args.no_plugins is True else True
    try:
        settings_path = load_settings(args.confdir)
    except:
        print("Configuration directory "+args.confdir+" could not be created! Exiting...")
        raise SystemExit()
    win = ScudCloud(settings_path=settings_path)
    app.singleStart(win, "scudcloud.pid")
    win.restore()
    sys.exit(app.exec_())

def load_settings(confdir):
    if not os.path.isdir(confdir):
        os.makedirs(confdir)
    if confdir not in sys.path:
        sys.path[0:0] = [confdir]
    return confdir

def parse_arguments():
    from argparse import ArgumentParser
    from os.path import expanduser
    if 'XDG_CONFIG_HOME' in os.environ and os.environ['XDG_CONFIG_HOME']:
        default_confdir = os.environ['XDG_CONFIG_HOME'] + '/scudcloud'
    else:
        default_confdir = '~/.config/scudcloud'
    parser = ArgumentParser()
    parser.add_argument('--confdir',    dest='confdir',      metavar='dir', default=default_confdir, help="change the configuration directory")
    parser.add_argument('--debug',      dest='debug',        type=bool,     default=False,           help="enable webkit debug console (default: False)")
    parser.add_argument('--minimized',  dest='minimized',    type=bool,     default=False,           help="start minimized to tray (default: False)")
    parser.add_argument('--no_plugins', dest='no_plugins',   type=bool,     default=False,           help="disable web plugins (default: False)")
    args = parser.parse_args()
    args.confdir = expanduser(args.confdir)
    return args

def exit(*args):
    if win is not None:
        win.exit()
    else:
        QSingleApplication.quit()

if __name__ == '__main__':
    main()

raelgc avatar Sep 03 '15 11:09 raelgc

Anyway, really thank you ALL for investigate this issue and all the feedback!

I woke up at 5:30 AM today to research the reason for the app missing the shutdown signal and a possible fix.

raelgc avatar Sep 03 '15 14:09 raelgc

@raelgc I tried the fix and it seams to work, still i believe it would be better to persist the cookie immediately after login if that is possible.

devng avatar Sep 03 '15 16:09 devng

@devng Yes, this will be good too (and I'll work on it), but the app was not responding to the interrupt signal anyway (appears to be a common problem with pyqt apps).

raelgc avatar Sep 03 '15 16:09 raelgc