*I have now updated the entire project structure and code. Below you can find some helpful tips on how to use some of the built-in features of this boilerplate. You can find all plugins that are used in plugins/default.js now.*
#### Authentication
Authentication has not changed much. This boilerplate does however now use session storage to store user data, such as: userId, username, email and accessToken (which is also set in localStorage). Upon logout all this information, including set cookies, are completely cleared. This boilerplate does not use a "remember me" feature, since this comes already built-in with most browsers and are best left to them to handle.
You can still use the update directive, like this:
```javascript
<mainv-update-authentication></main>
```
#### Messages
In `methods/messages.js` there are a few default notification messages. These can be called with `Vue.$_Messages`. You can, of course, add your own messages. Here is what the code looks like, in messages.js:
```javascript
Vue.$_Messages={
error:{
empty:{default:'You cannot leave a field empty.',specific:(data)=>'You cannot leave '+data+' empty.'},
email:{empty:'You cannot leave email empty.',invalid:'Invalid email. Please retype it, or, provide an actual email.'},
username:{empty:'You cannot leave username empty.',invalid:'Invalid username. Please, provide a valid username.'},
password:{empty:'You cannot leave password empty.',invalid:'Invalid password. Your password does not match our <a href="#modal">criteria</a> for a valid password.'}
},
success:{
login:{default:'You are now logged in.',withUsername:(username)=>'Welcome, '+username+'. You are now logged in.'}
The sign up function has changed a lot (you can find the file in `directives/register.js`). It is now a Vue directive instead. The `v-register` directive needs to be attached to a form. You also need to provide the data to look for (as in data props), as modifiers.
Here's an example:
```javascript
<formv-register.username.password.email>
<inputv-model="username"/>
<inputv-model="password"/>
<inputv-model="email"/>
</form>
```
...and then in date props make it look something like this:
```javascript
exportdefault{
data:function(){
return{
username:'',
password:'',
email:''
}
}
}
```
It will then automatically retrieve the information from the data props. **The form will also need to be verified, using this boilerplate's form validation. You can check its documentation further down.**
#### Login
The login is built very similar to the register. It is also a directive. It is used something like this:
```javascript
<formv-login.email.password>
<inputv-model="email"/>
<inputv-model="password"/>
</form>
```
The validation is used the same way as v-register, which again, you can find documentation about below.
#### Form validation
Forms using `v-register` and/or `v-login` needs its data validated. **This is different from the second validation included in this boilerplate, which can be found in the section under.**
These validations needs to be the same name as the v-model/data prop. *The validate prop has to return true or false (i.e, a boolean).* Example usage:
```javascript
data:function(){
return{
email:'',
password:'',
validate:()=>{
return{
email:Vue.$_Test.email(this.email),
password:Vue.$_Test.password(this.password)
}
}
}
}
```
*Vue.$_Test* will be referenced in a section below.
#### Input validation
This is a directive, and it has a couple of default options to validate. This can, of course, be added upon in `directives/validate.js`. The default ones are:
`Vue.$Store` is the Vuex instance. You can find the settings, etc. in `client/store/index.js`. Why store it in the `Vue`-object? Because this way it's available in the plugins too (since this.$store doesn't work in the plugins, but works in .vue files). To see options for Vuex, please click [here](https://vuex.vuejs.org/).
# Feathers
#### Changes in behavior
With the initial setup of Feathers JS, it is possible to create users via the REST service. **This has been disabled for this boilerplate.** If you want to be able to create users via, for example, Postman, please adjust this code (which can be found in *src/services/users/users.service.js*):