public async void ForgotPassword(View view)
        {
            ProgressDialog dialog = DialogHelper.CreateProgressDialog("Please wait...", this);
            dialog.Show();

            EditText StudentId = FindViewById<EditText>(Resource.Id.forgotStudentId);
            AuthService ForgotPasswordService = new AuthService();
            GenericResponse Response = await ForgotPasswordService.ForgotPassword(StudentId.Text);
            dialog.Hide();

            if (Response.Success)
            {

                AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.LightDialog);
                builder.SetTitle("Password Reset Sent");
                builder.SetMessage("Please check your emails to reset your password");
                builder.SetCancelable(false);
                builder.SetPositiveButton("OK", delegate { Finish(); });
                builder.Show();
            }
            else
            {
                DialogHelper.ShowDialog(this, Response.Message, Response.Title);
            }
        }
Beispiel #2
0
 static Services()
 {
     helpsDatabase.InitDatabase();
     Auth = new AuthService();
     Student = new StudentService();
     Workshop = new WorkshopService();
     Notification = new NotificationService();
     Session = new SessionService();
     Task.Factory.StartNew(HelpsService.Purge);
 }
Beispiel #3
0
        public async Task<GenericResponse> RegisterStudent(HelpsRegisterRequest request)
        {
            var response = helpsClient.PostAsJsonAsync("api/student/register", request).Result;

            if (response.IsSuccessStatusCode) {
                HelpsResponse decodedResponse = response.Content.ReadAsAsync<HelpsResponse>().Result;
                if (decodedResponse.IsSuccess)
                {
                    var user = userTable.CurrentUser();
                    user.HasLoggedIn = true;
                    AuthService auth = new AuthService();
                    GenericResponse Response = await auth.CompleteSetup(userTable.CurrentUser().StudentId);
                    if (Response.Success)
                    {
                        userTable.SetUser(user);
                        return ResponseHelper.Success();
                    }
                }
                else
                    return ResponseHelper.CreateErrorResponse("Registration Failed", decodedResponse.DisplayMessage);
            }
            return ResponseHelper.CreateErrorResponse("Registration Failed", "An unknown error occurred");            
        }