45
This commit is contained in:
@@ -23,7 +23,6 @@ pub fn (mut app App) post_signup(username string, email string, password string)
|
||||
@['/controller/signup']
|
||||
pub fn (mut app App) controller_signup() vweb.Result{
|
||||
username := app.query["username"]
|
||||
print(username)
|
||||
email := app.query["email"]
|
||||
password := app.query["password"]
|
||||
app.service_add_user(username, email, password) or {
|
||||
@@ -54,3 +53,18 @@ pub fn (mut app App) post_login(username string, password string) vweb.Result{
|
||||
|
||||
return app.json(user)
|
||||
}
|
||||
|
||||
@['/controller/login']
|
||||
pub fn (mut app App) controller_login() vweb.Result{
|
||||
username := app.query["username"]
|
||||
password := app.query["password"]
|
||||
user := app.service_login(username, password) or {
|
||||
mut noti := Noti{
|
||||
status: "failure",
|
||||
message: err.str()
|
||||
}
|
||||
return app.json(noti)
|
||||
}
|
||||
|
||||
return app.json(user)
|
||||
}
|
@@ -10,8 +10,10 @@
|
||||
<h1 class="text-3xl mb-6 font-bold text-center text-blue-500">Welcome Back!</h1>
|
||||
<form action="/login" method="post">
|
||||
<div class="mb-4">
|
||||
<label for="email" class="block text-sm font-medium leading-relaxed tracking-wide mb-2">Email:</label>
|
||||
<input type="email" id="email" name="email" placeholder="Enter email address" class="appearance-none bg-white rounded w-full py-2 px-4 leading-tight focus:outline-none focus:shadow-outline"/>
|
||||
<!-- <label for="email" class="block text-sm font-medium leading-relaxed tracking-wide mb-2">Email:</label>
|
||||
<input type="email" id="email" name="email" placeholder="Enter email address" class="appearance-none bg-white rounded w-full py-2 px-4 leading-tight focus:outline-none focus:shadow-outline"/> -->
|
||||
<label for="text" class="block text-sm font-medium leading-relaxed tracking-wide mb-2">Username:</label>
|
||||
<input type="text" id="email" name="username" placeholder="Enter username" class="appearance-none bg-white rounded w-full py-2 px-4 leading-tight focus:outline-none focus:shadow-outline"/>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="password" class="block text-sm font-medium leading-relaxed tracking-wide mb-2">Password:</label>
|
||||
|
Reference in New Issue
Block a user