diff --git a/api/src/controllers/UserController.kt b/api/src/controllers/UserController.kt index f8800f8..304181f 100644 --- a/api/src/controllers/UserController.kt +++ b/api/src/controllers/UserController.kt @@ -36,11 +36,11 @@ class UserController(kodein: Kodein) : KodeinController(kodein) { .where { Users.username eq credential.username } .map { row -> row[Users.email]!! to row[Users.password]!! } .firstOrNull() - ?: return@post call.respond(HttpStatusCode.BadRequest, ApiError.InvalidCredentialError) + ?: return@post call.respond(HttpStatusCode.Unauthorized, ApiError.InvalidCredentialError) if (!BCrypt.checkpw(credential.password, password)) { - return@post call.respond(HttpStatusCode.BadRequest, ApiError.InvalidCredentialError) + return@post call.respond(HttpStatusCode.Unauthorized, ApiError.InvalidCredentialError) } return@post call.respond(Response(simpleJwt.sign(email))) diff --git a/web/src/components/SigninForm.vue b/web/src/components/SigninForm.vue new file mode 100644 index 0000000..61d9b96 --- /dev/null +++ b/web/src/components/SigninForm.vue @@ -0,0 +1,79 @@ + + + diff --git a/web/src/router/index.js b/web/src/router/index.js index 5f43ce0..52ee0c1 100644 --- a/web/src/router/index.js +++ b/web/src/router/index.js @@ -2,6 +2,7 @@ import Vue from 'vue' import VueRouter from 'vue-router' import Home from '../views/Home.vue' import Signup from '../views/Signup.vue' +import Signin from '../views/Signin.vue' Vue.use(VueRouter) @@ -15,6 +16,11 @@ const routes = [ path: '/signup', name: 'Signup', component: Signup + }, + { + path: '/signin', + name: 'Signin', + component: Signin } ] diff --git a/web/src/store/index.js b/web/src/store/index.js index 332b916..387862b 100644 --- a/web/src/store/index.js +++ b/web/src/store/index.js @@ -4,12 +4,13 @@ import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ - state: { - }, - mutations: { - }, - actions: { - }, - modules: { - } + state: { + token: '' + }, + mutations: { + setToken: (state, {token}) => { + state.token = token; + } + }, + actions: {} }) diff --git a/web/src/views/Signin.vue b/web/src/views/Signin.vue new file mode 100644 index 0000000..a50e00d --- /dev/null +++ b/web/src/views/Signin.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file