mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
fix validation error
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user