<p>There is not a built-in way. If you take a look at the <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L726" rel="nofollow"><code>UserSessionService</code></a>, you'll see that messages are returned based on an error code. When a username and password combination fail, it triggers this single message to be returned.</p>

CC BY-SA 3.0
2015-04-16T18:20:45.770Z
2015-04-16T18:20:45.770Z
Aaron Berkowitz
<p>Hoping this is possible. I want to split the username and password error message to return it separately depending whether it is username or password that is incorrect and not just a the generic (Invalid username or password) message. How do I go about this? I don't require answers as to whether it is more secure or not just whether it is possible.</p>

<p>Cheers</p>

CC BY-SA 3.0
2015-04-16T14:44:43.067Z
Are you hoping to do this on the main craft login page or a custom form?
Aaron Berkowitz
CC BY-SA 3.0
2015-04-16T15:10:43.490Z
@AaronBerkowitz Custom form.
Lettie
CC BY-SA 3.0
2015-04-16T15:30:37.207Z
I don't believe there is a built-in way. If you take a look at the [`UserSessionService`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L726), you'll see that messages are returned based on an error code. When a username and password combination fail, it triggers this single message to be returned.
Aaron Berkowitz
CC BY-SA 3.0
2015-04-16T16:11:29.287Z
@AaronBerkowitz hmmm looks like that is the default message and there is no code for just username or password error although on the registration form it does split the 2 input fields. I wonder if there is a way of extending this with a plugin?
Lettie
CC BY-SA 3.0
2015-04-16T17:47:16.020Z
Yeah, nothing's stopping you from making a plugin that provides it's own login implementation. @AaronBerkowitz - Mind adding that as an answer?
Brad Bell
<users><form><login><error-templates>
How to split the user login error message between username and password?
# How to split the user login error message between username and password?

(Asked by: username_0 on 2015-04-16)

Hoping this is possible. I want to split the username and password error message to return it separately depending whether it is username or password that is incorrect and not just a the generic (Invalid username or password) message. How do I go about this? I don't require answers as to whether it is more secure or not just whether it is possible.

Cheers

**Tags:** users, form, login, error-templates

> **Comments:**
> **username_1**: Are you hoping to do this on the main craft login page or a custom form?  
> **username_0**: @AaronBerkowitz Custom form.  
> **username_1**: I don't believe there is a built-in way. If you take a look at the [`UserSessionService`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L726), you'll see that messages are returned based on an error code. When a username and password combination fail, it triggers this single message to be returned.  
> **username_0**: @AaronBerkowitz hmmm looks like that is the default message and there is no code for just username or password error although on the registration form it does split the 2 input fields. I wonder if there is a way of extending this with a plugin?  
> **username_2**: Yeah, nothing's stopping you from making a plugin that provides it's own login implementation. @AaronBerkowitz - Mind adding that as an answer?  

---

## 1 answers

### Answer by username_1 on 2015-04-16. Score: 1 | Accepted answer

There is not a built-in way. If you take a look at the [`UserSessionService`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/services/UserSessionService.php#L726), you'll see that messages are returned based on an error code. When a username and password combination fail, it triggers this single message to be returned.


---

