You're correct, the most affirmative action should be on the right because it is akin to the user moving on.
This article explains why, it uses the OK button as an example, but it equally applies to the Login button as well:
Why ‘Ok’ Buttons in Dialog Boxes Work Best on the Right
(I know I've linked twice to this site, but I'm not affiliated in any way)
To quote:
It’s similar to how pagination buttons are placed. The button that
takes users to the next page is on the right, and the button that
takes users back to their earlier page is on the left. This button
placement works because it maps to the user’s left-to-right reading
and navigating direction, where right is the direction to progress and
left is the direction to regress.
‘Ok’ and ‘Cancel’ buttons in dialog boxes should follow a similar
interaction pattern because they function like pagination buttons. Not
only that, but the left and right directional pattern is what users
are used to in the western world. Placing your primary action on the
right and secondary action on the left will make your dialog box
buttons easier and more intuitive for users to understand.
Ok progresses users forward to the next screen and ‘Cancel’
regresses users back to their original screen.
The same would equally apply to the Login and Cancel buttons.
Jakob Nielson suggests that it may not actually matter, but that listing OK improves the flow:
OK–Cancel or Cancel–OK?