develop #10

Merged
s426229 merged 80 commits from develop into master 2021-01-27 18:32:19 +01:00
14 changed files with 964 additions and 724 deletions
Showing only changes of commit 08c27b3c3a - Show all commits

View File

@ -27,6 +27,8 @@ namespace Klient.Droid
public string savedName = ""; public string savedName = "";
public string savedSurname = ""; public string savedSurname = "";
public string savedEmail = ""; public string savedEmail = "";
private string userId = "";
private string userToken = "";
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
@ -43,15 +45,14 @@ namespace Klient.Droid
var Login = FindViewById<EditText>(Resource.Id.Login).Text; var Login = FindViewById<EditText>(Resource.Id.Login).Text;
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.Password).Text).SecurePassword; SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.Password).Text).SecurePassword;
if (Login.Length < 3 || Login.Length > 12)
{
SetContentView(Resource.Layout.ekranLogowania);
}
if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password)) if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
{ {
SetContentView(Resource.Layout.ekranLogowania); FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!";
FindViewById<EditText>(Resource.Id.Password).Text = "";
} }
else
{
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
{ "login", Login }, { "login", Login },
@ -59,22 +60,30 @@ namespace Klient.Droid
}; };
var content = new FormUrlEncodedContent(values); var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/SignIn", content); var response = await client.PostAsync("http://10.0.2.2:5001/api/User/SignIn", content);
if (response.StatusCode == HttpStatusCode.OK) if (response.StatusCode == HttpStatusCode.OK)
{ {
savedLogin = Login;
var jsonString = await response.Content.ReadAsStringAsync(); var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString); dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
SetContentView(Resource.Layout.ekranPoLogowaniu); SetContentView(Resource.Layout.ekranPoLogowaniu);
savedLogin = jsonObject.user.login;
savedName = jsonObject.user.name; savedName = jsonObject.user.name;
savedEmail = jsonObject.user.email; savedEmail = jsonObject.user.email;
savedSurname = jsonObject.user.surname; savedSurname = jsonObject.user.surname;
userId = jsonObject.user.id;
userToken = jsonObject.jwt.token;
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", userToken);
}
else
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = msg;
FindViewById<EditText>(Resource.Id.Password).Text = "";
} }
} }
}
[Java.Interop.Export("SignUp")] [Java.Interop.Export("SignUp")]
async public void SignUp(View v) async public void SignUp(View v)
@ -86,11 +95,36 @@ namespace Klient.Droid
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword; SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword;
SecureString Password2 = new NetworkCredential("", FindViewById<EditText>(Resource.Id.RepeatPassword).Text).SecurePassword; SecureString Password2 = new NetworkCredential("", FindViewById<EditText>(Resource.Id.RepeatPassword).Text).SecurePassword;
if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password) if (Login.Length < 3 || Login.Length > 12)
{ {
SetContentView(Resource.Layout.ekranRejestracji); FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Login musi mięć od 3 do 12 znaków!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else if (new NetworkCredential("", Password).Password.Length < 8 || new NetworkCredential("", Password).Password.Length > 20)
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Hasło musi mieć od 8 do 20 znaków!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
} }
else if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password)
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Hasła muszą być identyczne!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else if(string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.NewLogin).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Email).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.NewPassword).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.RepeatPassword).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Name).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Surname).Text))
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Wartości nie mogą być puste!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else
{
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
{ "email", Email }, { "email", Email },
@ -107,6 +141,14 @@ namespace Klient.Droid
var responseString = await response.Content.ReadAsStringAsync(); var responseString = await response.Content.ReadAsStringAsync();
if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranLogowania); if (response.StatusCode == HttpStatusCode.OK) SetContentView(Resource.Layout.ekranLogowania);
else
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = msg;
FindViewById<EditText>(Resource.Id.Password).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
}
} }
[Java.Interop.Export("HelpLoginScreen")] [Java.Interop.Export("HelpLoginScreen")]
@ -129,10 +171,14 @@ namespace Klient.Droid
[Java.Interop.Export("about")] [Java.Interop.Export("about")]
public void MainScreenAbout(View v) public void MainScreenAbout(View v)
{
SetContentView(Resource.Layout.ekranInformacji);
}
[Java.Interop.Export("GoToMainScreenFromInformation")]
public void GoToMainScreenFromInformation(View v)
{ {
SetContentView(Resource.Layout.ekranStartowy); SetContentView(Resource.Layout.ekranStartowy);
} }
[Java.Interop.Export("LoadFromFolder")] [Java.Interop.Export("LoadFromFolder")]
public void LoadFile(View v) public void LoadFile(View v)
{ {
@ -142,6 +188,16 @@ namespace Klient.Droid
StartActivityForResult(Android.Content.Intent.CreateChooser(Intent, "Select Picture"), PickImageId); StartActivityForResult(Android.Content.Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
} }
[Java.Interop.Export("GoToStart")]
public void GoToStart(View v)
{
SetContentView(Resource.Layout.ekranStartowy);
}
[Java.Interop.Export("GoToPoLogowaniu")]
public void GoToPoLogowaniu(View v)
{
SetContentView(Resource.Layout.ekranPoLogowaniu);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data) protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
{ {
@ -167,6 +223,15 @@ namespace Klient.Droid
break; break;
} }
var response = await client.PostAsync("http://10.0.2.2:5001/api/Image/Process", formDataContent); var response = await client.PostAsync("http://10.0.2.2:5001/api/Image/Process", formDataContent);
if(response.StatusCode == HttpStatusCode.OK)
{
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!";
}
else
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = msg;
}
} }
} }
@ -174,6 +239,10 @@ namespace Klient.Droid
public void GoToProfile(View v) public void GoToProfile(View v)
{ {
SetContentView(Resource.Layout.ekranProfil); SetContentView(Resource.Layout.ekranProfil);
FindViewById<EditText>(Resource.Id.ChangeName).Text = savedName;
FindViewById<EditText>(Resource.Id.ChangeSurname).Text = savedSurname;
FindViewById<EditText>(Resource.Id.ChangeEmail).Text = savedEmail;
FindViewById<TextView>(Resource.Id.ProfilPageLogin).Text = savedLogin;
} }
[Java.Interop.Export("Save")] [Java.Interop.Export("Save")]
@ -197,19 +266,30 @@ namespace Klient.Droid
} }
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
{ "id", userId },
{ "email", Email }, { "email", Email },
{ "name", Name }, { "name", Name },
{ "surname", Surname }, { "surname", Surname },
{ "login", savedLogin } { "login", savedLogin }
}; };
var content = new FormUrlEncodedContent(values); var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Update", content); var response = await client.PostAsync("http://10.0.2.2:5001/api/User/Update", content);
var responseString = await response.Content.ReadAsStringAsync(); if (response.StatusCode == HttpStatusCode.OK)
{
if (response.StatusCode == HttpStatusCode.OK) FindViewById<TextView>(Resource.Id.NullValueProfile).Text = "Zapisano!"; FindViewById<TextView>(Resource.Id.NullValueProfile).Text = "Zapisano!";
var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
savedLogin = jsonObject.login;
savedName = jsonObject.name;
savedEmail = jsonObject.email;
savedSurname = jsonObject.surname;
}
else
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.NullValueProfile).Text = msg;
}
} }
} }
} }

View File

@ -48,6 +48,7 @@
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime> <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" /> <Reference Include="Mono.Android" />
<Reference Include="Mono.Android.Export" /> <Reference Include="Mono.Android.Export" />
<Reference Include="System" /> <Reference Include="System" />
@ -148,6 +149,11 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResourceAnalysisConfig Include="Resources\layout\ekranInformacji.xml">
<SubType>Designer</SubType>
</AndroidResourceAnalysisConfig>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffbdd7f0"
android:paddingTop="30dp">
<TextView
android:text="Poszukiwacz"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/title"
android:layout_centerHorizontal="true"
android:textSize="50dp"
android:textStyle="bold" />
<TextView
android:text="Poszukiwacz jest aplikacją mobilną pozwalającą na wyszukiwanie w Internece stron zawierających schematy i tutoriale na podstawie treści zadania. \n Jednocześnie pomaga w nauce, jaki i przyśpiesza proces dokonywania researchu danych. "
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView1"
android:layout_below="@id/title"
android:layout_centerInParent="true"
android:gravity="center_horizontal" />
<TextView
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text1"
android:textColor="#ff000000"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backInformation"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToMainScreenFromInformation" />
</RelativeLayout>

View File

@ -71,8 +71,28 @@
android:textColor="#fffcfcfc" android:textColor="#fffcfcfc"
android:gravity="center" android:gravity="center"
android:onClick="HelpLoginScreen" /> android:onClick="HelpLoginScreen" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backLogowanie"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToStart"/>
<TextView <TextView
android:text="Poszukiwacz 2020" android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ErrorLogIn"
android:textColor="#ffd60000"
android:layout_below="@id/In"
android:layout_centerHorizontal="true" />
<TextView
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -81,8 +101,4 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" /> android:layout_centerHorizontal="true" />
</RelativeLayout> </RelativeLayout>

View File

@ -21,7 +21,8 @@
android:layout_marginLeft="75dp" android:layout_marginLeft="75dp"
android:onClick="LoadFromFolder" /> android:onClick="LoadFromFolder" />
<TextView <TextView
android:text="Poszukiwacz 2020" android:text="Poszukiwacz 2021"
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -27,5 +27,24 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_below="@id/SendPhoto" android:layout_below="@id/SendPhoto"
android:textColor="#ffd60000" /> android:textColor="#ffd60000" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backZdjecie"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToPoLogowaniu" />
<TextView
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text1"
android:textColor="#ff000000"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout> </RelativeLayout>

View File

@ -7,11 +7,21 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#ffbdd7f0"> android:background="#ffbdd7f0">
<TextView
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ProfilPageLogin"
android:layout_centerHorizontal="true"
android:textStyle="bold"
android:textSize="30dp" />
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:id="@+id/LayoutNameC" android:id="@+id/LayoutNameC"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_below="@id/ProfilPageLogin"
android:hint="Imie" android:hint="Imie"
android:layout_alignParentLeft="true"> android:layout_alignParentLeft="true">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
@ -83,5 +93,25 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_below="@id/Save" android:layout_below="@id/Save"
android:textColor="#ffd60000" /> android:textColor="#ffd60000" />
<TextView
android:text="Poszukiwacz 2021"
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text3"
android:textColor="#ff000000"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backProfil"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToPoLogowaniu" />
</RelativeLayout> </RelativeLayout>

View File

@ -99,7 +99,6 @@
android:minWidth="25px" android:minWidth="25px"
android:minHeight="25px" android:minHeight="25px"
android:id="@+id/RepeatPassword" android:id="@+id/RepeatPassword"
android:hint="Powtórz hasło"
android:inputType="none|textPassword" android:inputType="none|textPassword"
android:textColor="#ff000000" /> android:textColor="#ff000000" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -117,7 +116,6 @@
android:minWidth="25px" android:minWidth="25px"
android:minHeight="25px" android:minHeight="25px"
android:id="@+id/NewLogin" android:id="@+id/NewLogin"
android:hint="Login"
android:textColor="#ff000000" android:textColor="#ff000000"
android:layout_below="@+id/Surname" /> android:layout_below="@+id/Surname" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -134,7 +132,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:onClick="SignUp" /> android:onClick="SignUp" />
<TextView <TextView
android:text="Poszukiwacz 2020" android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -142,6 +140,15 @@
android:textColor="#ff000000" android:textColor="#ff000000"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" /> android:layout_centerHorizontal="true" />
<TextView
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ErrorRegister"
android:textColor="#ffd60000"
android:layout_below="@id/SignUp"
android:layout_centerHorizontal="true" />
<Button <Button
android:text="?" android:text="?"
android:layout_width="35.0dp" android:layout_width="35.0dp"
@ -153,5 +160,16 @@
android:textColor="#fffcfcfc" android:textColor="#fffcfcfc"
android:gravity="center" android:gravity="center"
android:onClick="HelpRegisterScreen" /> android:onClick="HelpRegisterScreen" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backRejestracja"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToStart" />
</RelativeLayout> </RelativeLayout>

View File

@ -20,7 +20,7 @@
android:textSize="45dp" android:textSize="45dp"
android:layout_marginVertical="100dp" /> android:layout_marginVertical="100dp" />
<TextView <TextView
android:text="Poszukiwacz 2020" android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -29,27 +29,16 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" /> android:layout_centerHorizontal="true" />
<Button <Button
android:text="?" android:text="i"
android:layout_width="35.0dp" android:layout_width="35.0dp"
android:layout_height="35.0dp" android:layout_height="35.0dp"
android:id="@+id/help" android:id="@+id/about"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:background="#ff0b31c8" android:background="#ff0b31c8"
android:textColor="#fffcfcfc" android:textColor="#fffcfcfc"
android:gravity="center" android:gravity="center"
android:onClick="HelpLoginScreen" /> android:onClick="HelpLoginScreen" />
<Button
android:text="I"
android:layout_width="35.0dp"
android:layout_height="35.0dp"
android:id="@+id/about"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="AboutMainScreen" />
<Button <Button
android:text="Zaloguj" android:text="Zaloguj"
android:layout_width="200.0dp" android:layout_width="200.0dp"

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Serwer.Infrastructure.Services; using Serwer.Infrastructure.Services;
using System; using System;
@ -19,6 +20,7 @@ namespace Serwer.Api.Controllers
_imageService = imageService; _imageService = imageService;
} }
[Authorize]
[HttpPost("Process")] [HttpPost("Process")]
public async Task<IActionResult> Process([FromForm]IFormFile image) public async Task<IActionResult> Process([FromForm]IFormFile image)
{ {

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Serwer.Infrastructure.Services; using Serwer.Infrastructure.Services;
using System; using System;
@ -18,6 +19,7 @@ namespace Serwer.Api.Controllers
_searchService = searchService; _searchService = searchService;
} }
[Authorize]
[HttpGet("{query}")] [HttpGet("{query}")]
public async Task<IActionResult> Search(string query) public async Task<IActionResult> Search(string query)
{ {

View File

@ -69,7 +69,7 @@ namespace Serwer.Infrastructure.Services
throw new Exception("User login taken."); throw new Exception("User login taken.");
} }
var newUser = new User(user.Id, userModel.Email, userModel.Name, userModel.Surname, userModel.Login, userModel.Password); var newUser = new User(user.Id, userModel.Email, userModel.Name, userModel.Surname, userModel.Login, user.Password);
await _userRepository.UpdateAsync(newUser); await _userRepository.UpdateAsync(newUser);
newUser = await _userRepository.GetAsync(user.Id); newUser = await _userRepository.GetAsync(user.Id);
return _mapper.Map<UserDto>(newUser); return _mapper.Map<UserDto>(newUser);

View File

@ -13,6 +13,5 @@ namespace Serwer.Infrastructure.ViewModels
public string Name { get; set; } public string Name { get; set; }
public string Surname { get; set; } public string Surname { get; set; }
public string Login { get; set; } public string Login { get; set; }
public string Password { get; set; } = null;
} }
} }