add nullchecks for user's entry in login and register pages
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

pull/55/head
Maxime BATISTA 2 years ago
parent 3b9d9f197a
commit fdca99b589

@ -14,6 +14,16 @@ namespace ShoopNCook.Controllers
public void Login(string email, string password)
{
if (email == null)
{
UserNotifier.Notice("Please provide an email address");
return;
}
if (password == null)
{
UserNotifier.Notice("Please provide your password");
return;
}
Account? acc = accounts.Login(email, password);
if (acc == null)
{
@ -25,6 +35,21 @@ namespace ShoopNCook.Controllers
public void Register(string username, string email, string password)
{
if (email == null)
{
UserNotifier.Notice("Please provide an email address");
return;
}
if (password == null)
{
UserNotifier.Notice("Please provide your password");
return;
}
if (username == null)
{
UserNotifier.Notice("Please provide an username");
return;
}
Account? acc = accounts.Register(username, email, password);
if (acc == null)
{

@ -16,21 +16,21 @@ public partial class CreateRecipePage : ContentPage
this.onRecipeCreated = onRecipeCreated;
}
private async void OnAddIngredientTapped(object sender, TappedEventArgs e)
private void OnAddIngredientTapped(object sender, TappedEventArgs e)
{
IngredientList.Children.Add(new IngredientEntry());
}
private async void OnAddStepTapped(object sender, TappedEventArgs e)
private void OnAddStepTapped(object sender, TappedEventArgs e)
{
StepList.Children.Add(new StepEntry((uint) StepList.Children.Count() + 1));
}
private async void OnBackButtonClicked(object sender, EventArgs e)
{
Navigation.PopAsync();
await Navigation.PopAsync();
}
private async void OnUploadRecipeClicked(object sender, EventArgs e)
private void OnUploadRecipeClicked(object sender, EventArgs e)
{
uint callPerPers;

@ -29,13 +29,13 @@ public partial class FavoritesPage : ContentPage
{
RecipeViewLayout.Children.Add(new RecipeView(info, async () =>
{
Recipe? recipe = service.GetRecipe(info);
Recipe recipe = service.GetRecipe(info);
await Shell.Current.Navigation.PushAsync(new RecipePage(recipe, preferences, 1));
}));
});
}
private async void ContentPage_NavigatedTo(object sender, NavigatedToEventArgs e)
private void ContentPage_NavigatedTo(object sender, NavigatedToEventArgs e)
{
UpdateFavorites();
}

@ -19,7 +19,7 @@ public partial class HomePage : ContentPage
{
layout.Children.Add(new RecipeView(info, () =>
{
Recipe? recipe = service.GetRecipe(info);
Recipe recipe = service.GetRecipe(info);
if (recipe != null)
Shell.Current.Navigation.PushAsync(new RecipePage(recipe, preferences, 1));
else
@ -36,9 +36,6 @@ public partial class HomePage : ContentPage
ProfilePictureName.Text = account.User.Name;
}
private async void OnSyncButtonClicked(object sender, EventArgs e)
{
await Shell.Current.Navigation.PushAsync(new SearchPage());

@ -11,7 +11,7 @@ public partial class LoginPage : ContentPage
InitializeComponent();
this.controller = controller;
}
private async void OnLoginButtonClicked(object sender, EventArgs e)
private void OnLoginButtonClicked(object sender, EventArgs e)
{
string email = EmailEntry.Text;
string password = PasswordEntry.Text;

Loading…
Cancel
Save