Skip to content

Commit ffc9ab3

Browse files
authored
Merge pull request #7 from xconnio/remove-guest-login
remove guest login
2 parents d37aaa0 + 17d620e commit ffc9ab3

3 files changed

Lines changed: 2 additions & 70 deletions

File tree

src/services/authService.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ export const authService = {
2222
}
2323
},
2424

25-
async createGuestAccount(username: string, name: string, password: string) {
26-
const s = await wampService.connectWithCryptosign(REGISTRATION_AUTHID, REGISTRATION_SECRET)
27-
try {
28-
const result = await s.call('io.xconn.deskconn.account.create', [
29-
username,
30-
name,
31-
'guest',
32-
password,
33-
])
34-
return { result, session: s }
35-
} catch (err) {
36-
await s.close().catch(console.error)
37-
throw err
38-
}
39-
},
40-
4125
async verifyAccount(session: WampSession | null, username: string, code: string) {
4226
let s = session
4327

src/stores/auth.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,6 @@ export const useAuthStore = defineStore('auth', () => {
138138
}
139139
}
140140

141-
async function loginAsGuest() {
142-
const timestamp = Date.now()
143-
const randomSuffix = Math.floor(Math.random() * 10000)
144-
const email = `guest_${timestamp}_${randomSuffix}@deskconn.local`
145-
// Ensure password meets complexity: 8+ chars, 1 Capital, 1 Symbol
146-
const password = `Guest_${timestamp}_${randomSuffix}!`
147-
const name = `Guest User ${randomSuffix}`
148-
149-
try {
150-
const { session: regSession } = await authService.createGuestAccount(email, name, password)
151-
// Close the registration session as we need to login with new credentials
152-
if (regSession) {
153-
await regSession.close().catch(console.error)
154-
}
155-
156-
// Perform login
157-
await login(email, password)
158-
} catch (err) {
159-
console.error('Guest login failed', err)
160-
throw err
161-
}
162-
}
163-
164141
async function login(username: string, password: string) {
165142
// 1. Connect via CRA & Get Account
166143
const { session: s, result } = await authService.login(username, password)
@@ -265,7 +242,6 @@ export const useAuthStore = defineStore('auth', () => {
265242
autoLogin,
266243
forgotPassword,
267244
resetPassword,
268-
loginAsGuest,
269245
logout,
270246
updateProfile,
271247
}

src/views/LoginView.vue

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ const handleLogin = async () => {
6565
}
6666
}
6767
68-
const handleGuestLogin = async () => {
69-
try {
70-
error.value = ''
71-
await authStore.loginAsGuest()
72-
router.push('/')
73-
} catch (e: unknown) {
74-
console.error(e)
75-
const errorMsg = e instanceof Error ? e.message : String(e)
76-
error.value = 'Guest login failed: ' + errorMsg
77-
}
78-
}
79-
8068
const handleSuccessConfirm = () => {
8169
modalInstance?.hide()
8270
router.push('/')
@@ -122,8 +110,8 @@ const handleSuccessConfirm = () => {
122110
placeholder="••••••••"
123111
autocomplete="current-password"
124112
/>
125-
<button
126-
type="button"
113+
<button
114+
type="button"
127115
class="btn btn-password-toggle"
128116
@click="showPassword = !showPassword"
129117
tabindex="-1"
@@ -153,22 +141,6 @@ const handleSuccessConfirm = () => {
153141
<router-link to="/register" class="fw-bold">Sign up</router-link>
154142
</div>
155143

156-
<div class="text-center mt-3">
157-
<div class="position-relative">
158-
<hr class="text-muted opacity-25" />
159-
<span
160-
class="position-absolute top-50 start-50 translate-middle bg-white px-2 text-muted small"
161-
>OR</span
162-
>
163-
</div>
164-
<a
165-
href="#"
166-
class="text-secondary text-decoration-none small fw-bold mt-3 d-inline-block"
167-
@click.prevent="handleGuestLogin"
168-
>
169-
Login as Guest
170-
</a>
171-
</div>
172144
</form>
173145
</div>
174146
</div>

0 commit comments

Comments
 (0)