Check the domain when adding or removing accounts from commandline

main
Bob Mottram 2021-02-24 12:08:36 +00:00
parent a0a800c980
commit 36e921a06d
1 changed files with 14 additions and 0 deletions

View File

@ -1617,6 +1617,13 @@ if args.addaccount:
if not args.domain or not getConfigParam(baseDir, 'domain'):
print('Use the --domain option to set the domain name')
sys.exit()
configuredDomain = getConfigParam(baseDir, 'domain')
if configuredDomain:
if domain != configuredDomain:
print('The account domain is expected to be ' + configuredDomain)
sys.exit()
if not validNickname(domain, nickname):
print(nickname + ' is a reserved name. Use something different.')
sys.exit()
@ -1688,6 +1695,13 @@ if args.rmaccount:
if not args.domain or not getConfigParam(baseDir, 'domain'):
print('Use the --domain option to set the domain name')
sys.exit()
configuredDomain = getConfigParam(baseDir, 'domain')
if configuredDomain:
if domain != configuredDomain:
print('The account domain is expected to be ' + configuredDomain)
sys.exit()
if args.deactivate:
if deactivateAccount(baseDir, nickname, domain):
print('Account for ' + nickname + '@' + domain +