Skip to content

Nic21003 experimental #11

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions StudentFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def createStudent(studentID, studentPWD, enrolledCourses = []):
Item = {
'StudentId' : studentID,
'StudentPWD' : studentPWD,
'EnrolledCourses' : enrolledCourses
'EnrolledCourses' : enrolledCourses,
'AuthToken' : None
}
)

Expand All @@ -19,4 +20,4 @@ def createStudent(studentID, studentPWD, enrolledCourses = []):


if __name__ == "__main__":
createStudent("awp10101", "myPassword")
createStudent("testUser", "myNewPassword")
Binary file added class_registration_app/ngrok 2
Binary file not shown.
2 changes: 2 additions & 0 deletions class_registration_app/src/components/DashBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<RouterLink to="./courses">
<button class="uconn-button">Course Search</button>
</RouterLink>
<RouterLink to="./my_courses">
<button class="uconn-button">Current Classes</button>
</RouterLink>
</div>
</div>
</template>
Expand Down
12 changes: 12 additions & 0 deletions class_registration_app/src/components/EnrolledCourseList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script setup lang="ts">
</script>

<template>
<div class="container">
<h1>My Classes</h1>
</div>

</template>

<style scoped>
</style>
68 changes: 52 additions & 16 deletions class_registration_app/src/components/LoginPage.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,58 @@
<script setup lang="ts">

</script>

<template>
<section class="form animated flipInX">
<h2>Login To Your Account</h2>
<p class="valid">Valid. Please wait a moment.</p>
<p class="error">Error. Please enter correct Username &amp; password.</p>
<form class="loginbox" autocomplete="off">
<input placeholder="Username" type="text" id="username"/>
<input placeholder="Password" type="password" id="password"/>
<RouterLink to="./dashboard">
<button id="submit">Login</button>
<section class="form animated flipInX">
<h2>Login To Your Account</h2>
<p class="valid">Valid. Please wait a moment.</p>
<p class="error">Error. Please enter correct Username &amp; password.</p>
<form class="loginbox" autocomplete="off">
<input placeholder="Username" type="text" id="username" v-model="data.username" />
<input placeholder="Password" type="password" id="password" v-model="data.password"/>
<RouterLink v-if="!authenticationFailed" to="./dashboard" @click.prevent="tryLogin"> <!--use v-if here-->
<button id="submit">Login</button>
</RouterLink>
</form>
<RouterLink to="/">Back</RouterLink>
</section>
</form>
<RouterLink to="/">Back</RouterLink>
</section>
</template>

<script setup lang="ts">
import router from '@/router';
import axios from 'axios';
import { reactive } from 'vue';

const data = reactive({
username: '',
password: '',
});

let authenticationFailed = false;

const tryLogin = async () => {
const apiUrl = `https://yqoa0pwe5b.execute-api.us-east-1.amazonaws.com/login/get-list?username=${data.username}&password=${data.password}`;
try {
const response = await axios.get(apiUrl, {
params: {
// Enter query parameters here
},
});
console.log(response.data);
const res = response.data;

if (authenticationSucceeds(res)) {
await router.push({path: '/dashboard'});
} else {
authenticationFailed = true;
}

} catch (error) {
console.error(error);
authenticationFailed = true;
}
};

const authenticationSucceeds = (response) => {
return response.data && response.data.statusCode === 200;
};
</script>

<style scoped>
section {
Expand Down
6 changes: 6 additions & 0 deletions class_registration_app/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import RegisterAccount from '../components/RegisterAccount.vue'
import CourseSearch from '../components/CourseSearch.vue'
import ScheduleView from '../components/ScheduleView.vue'
import DashBoard from '../components/DashBoard.vue'
import EnrolledCourseList from '../components/EnrolledCourseList.vue'

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
Expand Down Expand Up @@ -41,6 +42,11 @@ const router = createRouter({
path: '/schedule_viewer',
name: 'Schedule Viewer',
component: ScheduleView
},
{
path: '/my_courses',
name: 'My Courses',
component: EnrolledCourseList
}

]
Expand Down