Open tsvilans opened 5 years ago
Step 0:
Logging in with the same email and server as an existing user account should not be possible.
It is possible.
Any project that creates / uses SpeckleCache.db. PySpeckle creates a SpeckleCache.db file if none is found and enforces uniqueness.
SpeckleCache.db
PySpeckle
When creating Account table in SpeckleCache.db, set RestApi and Email to be unique by doing UNIQUE(RestApi,Email).
Account
RestApi
Email
UNIQUE(RestApi,Email)
I.e. '''CREATE TABLE Account ([AccountId] integer NOT NULL PRIMARY KEY AUTOINCREMENT,[ServerName] varchar, [RestApi] varchar, [Email] varchar, [Token] varchar, [IsDefault] integer, UNIQUE(RestApi,Email))'''
'''CREATE TABLE Account ([AccountId] integer NOT NULL PRIMARY KEY AUTOINCREMENT,[ServerName] varchar, [RestApi] varchar, [Email] varchar, [Token] varchar, [IsDefault] integer, UNIQUE(RestApi,Email))'''
relates to #123 too :)
Step 0:
Expected Behaviour
Logging in with the same email and server as an existing user account should not be possible.
Actual Behaviour
It is possible.
Affected Projects
Any project that creates / uses
SpeckleCache.db
.PySpeckle
creates aSpeckleCache.db
file if none is found and enforces uniqueness.Proposed Solution (if any)
When creating
Account
table inSpeckleCache.db
, setRestApi
andEmail
to be unique by doingUNIQUE(RestApi,Email)
.I.e.
'''CREATE TABLE Account ([AccountId] integer NOT NULL PRIMARY KEY AUTOINCREMENT,[ServerName] varchar, [RestApi] varchar, [Email] varchar, [Token] varchar, [IsDefault] integer, UNIQUE(RestApi,Email))'''