|  | @@ -42,8 +42,8 @@ exports.login = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |    let role = null
 | 
	
		
			
				|  |  |    //if (process.env.ENV === 'production') {
 | 
	
		
			
				|  |  | -    role = user.peran.filter((e) => roleDataProduction.includes(e.peran.id))[0]
 | 
	
		
			
				|  |  | -    role.peran.id = convertRole(role.peran.id)
 | 
	
		
			
				|  |  | +  role = user.peran.filter((e) => roleDataProduction.includes(e.peran.id))[0]
 | 
	
		
			
				|  |  | +  role.peran.id = convertRole(role.peran.id)
 | 
	
		
			
				|  |  |    /*} else {
 | 
	
		
			
				|  |  |      role = user.peran.filter((e) => roleData.includes(e.peran.id))[0]
 | 
	
		
			
				|  |  |    }*/
 | 
	
	
		
			
				|  | @@ -66,20 +66,20 @@ exports.login = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |    } else {
 | 
	
		
			
				|  |  |      //if (process.env.ENV === 'production') {
 | 
	
		
			
				|  |  | -      if (cekUser.role.id !== role.peran.id) {
 | 
	
		
			
				|  |  | -        await userModel.updateOne({ _id: cekUser._id }, { role: dataRole })
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      if (!cekUser.lembaga) {
 | 
	
		
			
				|  |  | -        await userModel.updateOne(
 | 
	
		
			
				|  |  | -          { _id: cekUser._id },
 | 
	
		
			
				|  |  | -          { lembaga: role.organisasi }
 | 
	
		
			
				|  |  | -        )
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      if (cekUser.role.id !== role.peran.id || !cekUser.lembaga) {
 | 
	
		
			
				|  |  | -        cekUser = await userModel.findOne({
 | 
	
		
			
				|  |  | -          user_id: user.id,
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +    if (cekUser.role.id !== role.peran.id) {
 | 
	
		
			
				|  |  | +      await userModel.updateOne({ _id: cekUser._id }, { role: dataRole })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (!cekUser.lembaga) {
 | 
	
		
			
				|  |  | +      await userModel.updateOne(
 | 
	
		
			
				|  |  | +        { _id: cekUser._id },
 | 
	
		
			
				|  |  | +        { lembaga: role.organisasi }
 | 
	
		
			
				|  |  | +      )
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (cekUser.role.id !== role.peran.id || !cekUser.lembaga) {
 | 
	
		
			
				|  |  | +      cekUser = await userModel.findOne({
 | 
	
		
			
				|  |  | +        user_id: user.id,
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      //}
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -93,7 +93,10 @@ exports.login = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    const now = new Date()
 | 
	
		
			
				|  |  |    const time = now.getTime()
 | 
	
		
			
				|  |  |    now.setTime(time + 24 * 60 * 60 * 1000)
 | 
	
		
			
				|  |  | -  res.cookie('sidali-cookie', accessToken, { httpOnly: true, expires: now })
 | 
	
		
			
				|  |  | +  res.cookie('sidali-cookie', accessToken, {
 | 
	
		
			
				|  |  | +    httpOnly: true,
 | 
	
		
			
				|  |  | +    expires: now,
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    response.success(res, {
 | 
	
		
			
				|  |  |      message: 'Berhasil Login',
 | 
	
	
		
			
				|  | @@ -102,7 +105,9 @@ exports.login = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  exports.logout = (req, res) => {
 | 
	
		
			
				|  |  | -  res.cookie('sidali-cookie', '', { expires: new Date() })
 | 
	
		
			
				|  |  | +  res.cookie('sidali-cookie', '', {
 | 
	
		
			
				|  |  | +    expires: new Date(),
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    response.success(res, {
 | 
	
		
			
				|  |  |      message: 'Berhasil Logout',
 |