Added authorization form, fixed a bug when was changing roles, corrected tests