Skip to content

Commit

Permalink
Merge pull request #40 from mitre/fix/firefox-login
Browse files Browse the repository at this point in the history
Fix firefox login
  • Loading branch information
elegantmoose authored Feb 15, 2024
2 parents 5c36226 + 7fb0478 commit 99f0056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/stores/authStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const useAuthStore = defineStore({
await this.getGroup($api);
router.push({ name: this.returnUrl || "home" });
} catch (error) {
if (!error.response) throw "The server encountered an error";
if (error.response.status == 401) {
throw "Incorrect username or password";
}
Expand Down
5 changes: 3 additions & 2 deletions src/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ let password = ref("");
let loginError = ref("");
const $api = inject("$api");
async function handleLogin() {
async function handleLogin(e) {
e.preventDefault();
const authStore = useAuthStore();
try {
await authStore.login(username, password, $api);
Expand All @@ -33,7 +34,7 @@ async function handleLogin() {
input.input(v-model="password" type="password" placeholder="password")
span.icon.is-small.is-left
font-awesome-icon(icon="fas fa-lock")
button.button.fancy-button.is-fullwidth(type="submit" @click="handleLogin()") Log In
button.button.fancy-button.is-fullwidth(type="submit" @click="handleLogin") Log In
.has-text-danger
p {{ loginError }}
</template>
Expand Down

0 comments on commit 99f0056

Please sign in to comment.