Skip to content

Commit

Permalink
Merge pull request #2342 from torusresearch/fix/popup-login-issues
Browse files Browse the repository at this point in the history
remove double popup
  • Loading branch information
chaitanyapotti authored Jul 26, 2023
2 parents 9d59d61 + e72e958 commit 0ba8db8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
4 changes: 0 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ router.beforeResolve((to, from, next) => {
if (to.name === 'logout') {
return next()
}
// this is to prevent the router to add state back in the url when going to end page.
if (to.name === 'end') {
return next()
}
if (!hasQueryParameters(to) && hasQueryParameters(from)) {
return next({ name: to.name, query: from.query, hash: to.hash, params: to.params })
}
Expand Down
24 changes: 1 addition & 23 deletions src/views/Start/Start.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import log from 'loglevel'
import BoxLoader from '../../components/helpers/BoxLoader'
import { OpenLoginHandler } from '../../handlers/Auth'
import { FORCE_POPUP_LOGIN_MODE } from '../../utils/enums'
import { isMobileOrTablet } from '../../utils/utils'
export default {
name: 'Start',
Expand All @@ -47,7 +45,6 @@ export default {
},
},
async created() {
let isPopupMode = false
try {
const { loginProvider, state, mfaLevel, sessionNamespace, ...rest } = this.$route.query
const stateParams = JSON.parse(safeatob(state))
Expand All @@ -65,11 +62,7 @@ export default {
this.whiteLabel = whiteLabel
const openLoginHandler = await OpenLoginHandler.getInstance(whiteLabel, loginConfig, sessionNamespace)
if (FORCE_POPUP_LOGIN_MODE.includes(loginProvider) && isMobileOrTablet()) {
isPopupMode = true
openLoginHandler.openLoginInstance.options.uxMode = 'popup'
}
const data = await openLoginHandler.openLoginInstance.login({
await openLoginHandler.openLoginInstance.login({
loginProvider,
getWalletKey: true,
appState: state,
Expand All @@ -79,23 +72,8 @@ export default {
},
curve: 'secp256k1',
})
if (isPopupMode && data) {
// changing this back to redirect for other login providers.
openLoginHandler.openLoginInstance.options.uxMode = 'redirect'
this.$router.push({
name: 'end',
query: {},
})
}
} catch (error) {
log.info(error, 'something went wrong')
if (isPopupMode) {
this.$router.push({
name: 'end',
query: {},
hash: `#error=${error.message || 'something went wrong, please try again later'}`,
})
}
}
},
}
Expand Down

0 comments on commit 0ba8db8

Please sign in to comment.