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: [
@ -87,6 +88,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

@ -41,10 +41,12 @@ class _RegisterPageState extends State<RegisterPage> {
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(
children: [
const Image( const Image(
image: AssetImage('assets/logo.png'), image: AssetImage('assets/logo.png'),
height: 200, height: 200,
@ -79,7 +81,6 @@ class _RegisterPageState extends State<RegisterPage> {
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),
@ -87,13 +88,16 @@ class _RegisterPageState extends State<RegisterPage> {
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() {
usernameInput.dispose(); usernameInput.dispose();