This commit is contained in:
Mr Swift
2024-09-26 12:48:09 +03:30
parent 628bd6a782
commit dbb98d455c
4 changed files with 161 additions and 140 deletions
+15 -1
View File
@@ -7,7 +7,7 @@
<div class="col-12"> <div class="col-12">
<!---------------------- check for user login ----------------------> <!---------------------- check for user login ---------------------->
<div v-if="!$auth.loggedIn || !$auth.hasScope('user')" class="panel not-logged-in"> <div v-if="!$auth.loggedIn || !$auth.hasScope('user') " class="panel not-logged-in">
<h3> <h3>
<span> برای ثبت درخواست نمایندگی باید </span> <span> برای ثبت درخواست نمایندگی باید </span>
<nuxt-link :to="{ name: 'auth-login-register', query: { path: 'representation-enroll' } }" <nuxt-link :to="{ name: 'auth-login-register', query: { path: 'representation-enroll' } }"
@@ -20,6 +20,17 @@
</nuxt-link> </nuxt-link>
</h3> </h3>
</div> </div>
<!---------------------- check user for confirm ---------------------->
<div v-else-if="!userConfirm" class="panel is-agent">
<h3>
<span> برای ثبت درخواست نمایندگی باید </span>
<nuxt-link :to="{ name: 'account' }"
> حساب کاربری</nuxt-link
>
<span> خود را تایید کنید. </span>
</h3>
</div>
<!---------------------- check if user already is agent ----------------------> <!---------------------- check if user already is agent ---------------------->
<div v-else-if="$auth.loggedIn && $auth.hasScope('user') && user.isAgent" class="panel is-agent"> <div v-else-if="$auth.loggedIn && $auth.hasScope('user') && user.isAgent" class="panel is-agent">
@@ -63,6 +74,9 @@ export default {
}, },
userFullName() { userFullName() {
return this.user.first_name + ' ' + this.user.last_name return this.user.first_name + ' ' + this.user.last_name
},
userConfirm() {
return this.user.confirmed
} }
}, },
methods: {} methods: {}
@@ -173,7 +173,12 @@ module.exports.add_representation = [
checkValidations(validationResult), checkValidations(validationResult),
async (req, res) => { async (req, res) => {
const { user_id } = req const { user_id } = req
if (!user_id) throw new Error('invalid user id') const userData = await User.findById(user_id)
if (!userData || !userData.confirmed){
res.status(400).json({msg:'اول شماره تلفن و ایمیل خود را تایید کنید'})
}else{
const { const {
representation_type, representation_type,
full_name, full_name,
@@ -316,6 +321,8 @@ module.exports.add_representation = [
return res500(res, e) return res500(res, e)
} }
} }
}
] ]
module.exports.edit_representation_by_user = [ module.exports.edit_representation_by_user = [
+1 -1
View File
@@ -5,7 +5,7 @@ const inHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@asan-service:27017/as
const outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin' const outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin'
const init = ()=>{ const init = ()=>{
try { try {
mongoose.connect(inHostUrl, { mongoose.connect(outHostUrl, {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true,
useFindAndModify: false, useFindAndModify: false,