profile partly done. added scrolling on login and register page

This commit is contained in:
LilleBRG 2024-08-26 09:42:17 +02:00
parent 3e0f7229c4
commit b44d180284
6 changed files with 55 additions and 56 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ActiveDebugProfile>https</ActiveDebugProfile> <ActiveDebugProfile>http</ActiveDebugProfile>
<Controller_SelectedScaffolderID>ApiControllerWithContextScaffolder</Controller_SelectedScaffolderID> <Controller_SelectedScaffolderID>ApiControllerWithContextScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath> <Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth> <WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth>

View File

@ -29,9 +29,9 @@ namespace API.Application.Users.Commands
{ {
return new UnauthorizedObjectResult(new { message = "Invalid email or password." }); return new UnauthorizedObjectResult(new { message = "Invalid email or password." });
} }
var token = GenerateJwtToken(user); var jwtToken = GenerateJwtToken(user);
return new OkObjectResult(token); return new OkObjectResult(new { token = jwtToken, id = user.Id});
} }

View File

@ -2,6 +2,7 @@
using API.Persistence.Repositories; using API.Persistence.Repositories;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Templates.BlazorIdentity.Pages.Manage; using Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Templates.BlazorIdentity.Pages.Manage;
using Newtonsoft.Json.Linq;
namespace API.Application.Users.Queries namespace API.Application.Users.Queries
{ {
@ -23,14 +24,8 @@ namespace API.Application.Users.Queries
return new ConflictObjectResult(new { message = "No user on given Id" }); return new ConflictObjectResult(new { message = "No user on given Id" });
} }
UserDTO userDTO = new UserDTO return new OkObjectResult(new { id = user.Id, email = user.Email, username = user.Username, createdAt = user.CreatedAt });
{
Id = user.Id,
Email = user.Email,
Username = user.Username
};
return userDTO;
} }
} }

View File

@ -49,7 +49,8 @@ class _LoginPageState extends State<LoginPage> {
return SideMenu( return SideMenu(
selectedIndex: 4, selectedIndex: 4,
body: Scaffold( body: Scaffold(
body: Center( body: SingleChildScrollView(
child: Center(
child: Container( child: Container(
constraints: const BoxConstraints(minWidth: 100, maxWidth: 400), constraints: const BoxConstraints(minWidth: 100, maxWidth: 400),
child: Column(children: [ child: Column(children: [
@ -86,6 +87,7 @@ class _LoginPageState extends State<LoginPage> {
]), ]),
), ),
), ),
),
), ),
); );
} }

View File

@ -1,6 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';

View File

@ -37,17 +37,19 @@ class _RegisterPageState extends State<RegisterPage> {
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SideMenu( return SideMenu(
selectedIndex: 3, selectedIndex: 3,
body: Scaffold( body: Scaffold(
body: Center( body: SingleChildScrollView(
child: Center( // Added SingleChildScrollView here
child: Container( child: Container(
constraints: const BoxConstraints(minWidth: 100, maxWidth: 400), constraints: const BoxConstraints(minWidth: 100, maxWidth: 400),
child: Column(children: [ child: Column(
const Image( children: [
image: AssetImage('assets/logo.png'), const Image(
height: 200, image: AssetImage('assets/logo.png'),
height: 200,
), ),
Text( Text(
'SkanTravels', 'SkanTravels',
@ -56,43 +58,45 @@ class _RegisterPageState extends State<RegisterPage> {
color: Color(0xFF1862E7), color: Color(0xFF1862E7),
), ),
), ),
const SizedBox(height: 40), const SizedBox(height: 40),
const Text('Username'), const Text('Username'),
TextField(controller: usernameInput), TextField(controller: usernameInput),
const SizedBox(height: 30), const SizedBox(height: 30),
const Text('Email'), const Text('Email'),
TextField(controller: emailInput), TextField(controller: emailInput),
const SizedBox(height: 30), const SizedBox(height: 30),
const Text('Password'), const Text('Password'),
TextField( TextField(
controller: passwordInput, controller: passwordInput,
obscureText: true, obscureText: true,
enableSuggestions: false, enableSuggestions: false,
autocorrect: false autocorrect: false
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
const Text('Confirm Password'), const Text('Confirm Password'),
TextField( TextField(
controller: confirmPasswordInput, controller: confirmPasswordInput,
obscureText: true, obscureText: true,
enableSuggestions: false, enableSuggestions: false,
autocorrect: false, autocorrect: false,
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
ElevatedButton(
ElevatedButton( onPressed: _register, child: const Text('Register')),
onPressed: _register, child: const Text('Register')), const SizedBox(height: 10),
const SizedBox(height: 10), const Text('or'),
const Text('or'), TextButton(
TextButton( child: const Text('Login'),
child: const Text('Login'), onPressed: () => Navigator.pushReplacementNamed(context, '/login')),
onPressed: () => Navigator.pushReplacementNamed(context, '/login')), ],
]), ),
), ),
), ),
), ),
); ),
} );
}
@override @override
void dispose() { void dispose() {