[Users] Login as a registered user
Closed this issue · 2 comments
As a registered user, I'm able to log in.
Detailed description
The page should be available at /login
This page shows these elements:
- The title/name of this instance of the Datahub as configured in parameters.yml
- A box with a login form
The login box contains a login form with these elements:
- Username (textfield)
- Password (Password field)
- Remember me (checkbox)
- A submit button "log in"
- A link to the "Reset password" page
When "submit" is pressed, the data is first validated. Validation includes:
- Does the user exist?
- Is the user account enabled / active?
- Does the password match with the registered password?
If one of those validators fails on invalid form values, the administrator is navigated back to the form. The invalid fields are highlighted in red (or with an asterisk). A flash message indicates what went wrong.
After validation, a login session is initiated and the user is redirected back to the dashboard page. Depending on the role of the user (super admin / admin) extra menu items will appear in the menu: Users, OAuth,...
When I'm logged in, I can see a link "logout" in the main menu which takes me to the "logout" page.
When i'm logged in, I can see a link "Hello, xxx" with xxx linked to the "profile" page.
Possible implementation
We use FOSUserBundle (Symfony 2.8) to manage all things User related. This functionality should be wired up via FOSUserBundle.
The actions below should be implemented as functional tests.
- As an anonymous user, I can access the login page from the "login" link in the header navigation.
- As an anonymous user, I can login with valid credentials. I'm redirected to the dashboard page.
- As an anonymous user, I can not login with an invalid username. I'm redirected back to the login page, and a flash message appears telling me "invalid credentials".
- As an anonymous user, I can not login with an invalid password. I'm redirected back to the login page, and a flash message appears telling me "invalid credentials".
- As an anonymous user, I can see the title of the current instance of the datahub above the login box.
- As an already logged in user, I'm redirected back to the dashboard page when I try to access the login page.
- As an already logged in user, I can see a "logout" link in the main menu which will take me to the logout page.
- As an already logged in user, I can see a "Hi, xxx" string with xxx being the username, linked to the "profile" page of the currently logged in user. The string is located next to the logout link.
Implementation happens in UserBundle/UserController.
All sub features were implemented. Only "remember me" is left.