Even if you split the login into a separate app you will still have duplicated login code, since the forms and the controllers that use the api will need to be duplicated. Unless you use a common library to encapsulate common functionality. Then you need more features, bells and whistles. If you go on this path long enough you will just re-implement your own square wheel :)
Instead you can just use something that people already built.
By far the easiest way would be to remove all this stuff completely and only support openid.
Just like stackoverflow. Bundled with some smart openid-from-provider-and-username generation (again just like stackoverflow) this can accomodate almost anyone, thought this will need a little more work (but not much, the rules of generation should very trivial).
If you really need the standard user/password login form and just want centralized users db you can still use openid behind the scenes (see ruby-openid for both client and server parts implementation), or just use a simpler CAS solution (like ruby-cas)