Skip to content

Fix `ligo login` when user is logged in and tries to login again with a different user

Melwyn Saldanha requested to merge fix/ligo_login_user_already_logged_in into dev

Motivation and Context

When a user is already loggedin to LIGO registry, and tries to login as another user gets an error

Description

This MR fixes the bug, and also fixes the bug when the user interrupts(Ctrl+C) when logging it used to mess up the terminal state

In a follow up will add a subcommand for logout ligo logout

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Before:

$ ligo.55 login
Username: user1
Password: ************
you are authenticated as 'user1'
$ ligo.55 login
Username: user2
Password: ***************
{
  "error": "username is already registered"
}

After:

$ ligo login
Username: user1
Password: ************
you are authenticated as 'user1'
$ ligo login
Username: user2
Password: ***************
you are authenticated as 'user2'

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Melwyn Saldanha

Merge request reports