fix validation error

This commit is contained in:
Jack Goh
2018-07-04 12:01:32 +08:00
parent 54f6722472
commit 232baf76cd
2 changed files with 6 additions and 11 deletions
@@ -64,15 +64,17 @@ class RegisterController extends Controller
$marking = Marking::Where('email',$data['email'])->first();
if(!$marking){
return response()->json('Does not exist ', 400);
return response()->json(["message"=>"Does not exist"], 400);
}
if($marking->marking != $data['marking']){
return response()->json('Incorrect marking', 400);
return response()->json(["message"=>"Incorrect marking"], 400);
}
if(User::Where('email',$data['email'])->first()){
return response()->json('Email already exist in the system', 400);
return response()->json(["message"=>"Email already exist in the system"], 400);
}
$role = Role::where('name','=','member')->first();
$user = new User();
+1 -8
View File
@@ -56,9 +56,6 @@
</template>
</el-input>
<span class="text-danger" v-if="errors.has('password_confirmation')">{{ errors.first('password_confirmation') }}<br/></span>
<span class="text-danger" v-if="PasswordNotMatch()">
The password does not match
</span>
</div>
</div>
@@ -117,7 +114,7 @@ export default {
methods: {
async register () {
this.$validator.validateAll();
if (this.errors.any() || PasswordNotMatch()) {
if (this.errors.any()) {
return;
}
@@ -139,11 +136,7 @@ export default {
} else {
this.$router.push({ name: 'home' })
}
},
PasswordNotMatch:function(){
return !(this.form.password === this.form.password_confirmation);
}
}
}
</script>